Practice questions
Warm-up · 8
- 01Customer list, not started
- 02Products priced from 10 to 25, not started
- 03Kitchen catalog from most to least expensive, not started
- 04Products with no description, not started
- 05The three cheapest products, not started
- 06Rename a product and price five of them, not started
- 07Countries customers come from, not started
- 08Orders from 15 December 2010, not started
Easy · 21
- 09Orders by country and type, not started
- 10Providers with no encounters, not started
- 11Frequent customers, not started
- 122011 net sales by department, not started
- 13Users created in March 2025, not started
- 14People invited by several workspaces, not started
- 15Developers and their teams, not started
- 16Every developer, with a team label, not started
- 17Find the lamps, not started
- 18Spring orders from France and Germany, not started
- 19Average price by category, not started
- 20Price bands, not started
- 21Active buyers per month, not started
- 22How long did delivery take?, not started
- 23Create a wishlist table, not started
- 24Reprice the garden range, not started
- 72Predict: patients with and without missed appointments, not started
- 73Predict: unknown prices in a filter, not started
- 78Debug: find products with no description, not started
- 82Debug: February flights at the boundary, not started
- 138Predict: which trips are in January?, not started
Medium · 61
- 25Big spenders for their state, not started
- 26Monthly sales after cancellations, not started
- 27Bestsellers within each category, not started
- 28Seven-day rolling high temperature, not started
- 29More pull requests than their manager, not started
- 30Days with no orders, not started
- 31First and latest order per customer, not started
- 32Orders whose payments don’t match, not started
- 33Flight outcomes by origin state, not started
- 34Loyal customers who never returned anything, not started
- 35Average order value by month, not started
- 36Deployments versus incidents, not started
- 37Keep one invitation per person, not started
- 38A covering index for unit totals, not started
- 39A reusable customer totals view, not started
- 40Second-highest home-run total per team, not started
- 51Make the event-day filter searchable, not started
- 54Abandoned checkouts, not started
- 55Audit duplicate scans, not started
- 61Products bought together, not started
- 64Parse tracking numbers, not started
- 65Normalize invitee emails, not started
- 67Upgrade review 1: the daily pricing audience, not started
- 74Predict: count rows or known values?, not started
- 75Predict: positions and shared ranks, not started
- 77Predict: the previous leg of the same aircraft, not started
- 79Debug: keep carriers without next-day shipments, not started
- 80Debug: count zero projects correctly, not started
- 81Debug: the second-best win total, not started
- 84Grid review 1: regional demand on a peak day, not started
- 85Grid review 2: missing demand hours, not started
- 89Three New York stations side by side, not started
- 90Observation coverage by station, not started
- 91Signed invoice totals, not started
- 94Repeat reviews, distinct pull requests, not started
- 95Two measures, one stream, not started
- 98Reliability bands, not started
- 101Predict: integer and decimal ratios, not started
- 102Predict: missing passenger counts in an average, not started
- 103Predict: a recursive team path, not started
- 104Predict: dates across midnight, not started
- 105Predict: duplicate values in a set, not started
- 106Predict: NOT IN with an unknown alternative, not started
- 107Debug: observable tip rate, not started
- 108Debug: delay among operated flights, not started
- 109Debug: forecast accuracy, not started
- 110Debug: teams without active repositories, not started
- 111Debug: visits after joining observations, not started
- 112Debug: a duplicate scan is not another delivery, not started
- 114Teams that hosted each other, not started
- 119When did devices go silent?, not started
- 121Back-to-back failed deliveries, not started
- 122Each patient’s latest systolic reading, not started
- 123Purchases far above a card’s norm, not started
- 127A histogram of daily highs, not started
- 128How far do taxi trips go?, not started
- 132Developers who review each other, not started
- 133Routes flown in one direction only, not started
- 135Encounters that overlap in time, not started
- 136Predict: payments after joining line items, not started
- 137Debug: redelivered events, not started
Hard · 49
- 41Next-month retention by signup cohort, not started
- 42Longest winning streak, not started
- 43Customer segment at order time, not started
- 44Overlapping prescription fills, not started
- 45Management chain for every developer, not started
- 46Median home attendance per team, not started
- 47Build a country history from invoices, not started
- 48Settlements, refunds and disputes, not started
- 49Design a flight lookup index, not started
- 50Cover the export query, not started
- 52Latest failed deliveries without a sort, not started
- 53An ordered upgrade funnel, not started
- 56Sessionize retries and exact boundaries, not started
- 57Paid conversion by acquisition channel, not started
- 58A replay-safe ledger load, not started
- 59Enforce delivery-slot rules, not started
- 60Recover a partially failed transfer, not started
- 62Customers who bought from every Home category, not started
- 63Department audience overlap, not started
- 66Parse statement amounts into cents, not started
- 68Upgrade review 2: where the funnel drops, not started
- 69Upgrade review 3: time from checkout to subscription, not started
- 70Upgrade review 4: abandoned checkouts that came back, not started
- 71Upgrade review 5: which channels to fix first, not started
- 76Predict: a frame that includes peers, not started
- 83Debug: each account’s last posted amount, not started
- 86Grid review 3: June peak hours and ties, not started
- 87Grid review 4: does demand balance?, not started
- 88Grid review 5: monthly forecast error, not started
- 92What actually moved money?, not started
- 93Has the whole shipment arrived?, not started
- 96Last known daily maximum, not started
- 97Everyone below a director, not started
- 99State as known at an operational cutoff, not started
- 100Merge overlapping incident windows, not started
- 113Sustained warm intervals in cold storage, not started
- 115Device status at the end of each day, not started
- 116Carry the last good reading forward, not started
- 117Merged maintenance downtime, not started
- 118Continuous medication coverage, not started
- 120Three late legs in a row, not started
- 124Reviewers who cover every team repository, not started
- 125Headcount of each team tree, not started
- 126Direct and total reports, not started
- 129Median and 90th-percentile arrival delay, not started
- 130Fork families, not started
- 131Who is within two reviews?, not started
- 134Retried authorization requests, not started
- 139Debug: sessions and events per workspace, not started
task Join fan-out & cardinality · medium
Debug: visits after joining observations
Find each provider. Return provider_id and visits_with_vitals: encounters that recorded at least one observation. The query counts observations instead of visits. Fix it.
what to return
- Columns
provider_idvisits_with_vitalsin this order- Rows
- 425 rows · any order
- Skill
- Repair the query’s logic and confirm the fix on changed data. Refresher: Multi-grain joins without fan-out →
expected result
expected result425 rows · any order
| provider_id | visits_with_vitals |
|---|---|
| 1 | 34 |
| 2 | 35 |
| 3 | 5 |
first 3 of 425 rows
data you can query
encounters9 columns · 20,447 rows
| encounter_idnumber · unique id | patient_idnumber · links to patients | provider_idnumber · links to providers | encounter_classtext | start_atdate & time | end_atdate & time | reason_codetext | total_costdecimal | payer_paiddecimal |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 4 | ambulatory | 2022-08-07 13:00:00 | 2022-08-07 13:24:45 | T78.40XA | 175.6 | 159.38 |
| 2 | 1 | 4 | telehealth | 2022-10-12 11:15:00 | 2022-10-12 11:59:48 | E11.9 | 110.02 | 95.53 |
| 3 | 1 | 74 | telehealth | 2023-05-12 11:30:00 | 2023-05-12 12:13:27 | E11.9 | 83.68 | 74.77 |
| 4 | 1 | 349 | ambulatory | 2023-12-17 08:15:00 | 2023-12-17 08:39:33 | E11.9 | 198.23 | 187.3 |
| 5 | 1 | 4 | telehealth | 2024-05-09 16:45:00 | 2024-05-09 17:29:01 | E66.9 | 115.08 | 98.4 |
| 6 | 1 | 4 | ambulatory | 2024-09-07 13:00:00 | 2024-09-07 13:27:30 | E66.9 | 153.61 | 142.99 |
| 7 | 1 | 4 | ambulatory | 2025-03-21 14:45:00 | 2025-03-21 15:06:04 | E66.9 | 205.8 | 186.35 |
| 8 | 1 | 347 | urgent_care | 2025-04-13 19:00:00 | 2025-04-13 19:56:05 | U07.1 | 271.26 | 249.02 |
| 9 | 2 | 309 | ambulatory | 2022-09-03 12:30:00 | 2022-09-03 12:53:18 | K21.9 | 207.99 | 159.16 |
| 10 | 2 | 309 | ambulatory | 2022-12-17 14:30:00 | 2022-12-17 14:56:24 | J02.9 | 165.38 | 129.81 |
- encounter_idnumber · unique id
- 1
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 4
- encounter_classtext
- ambulatory
- start_atdate & time
- 2022-08-07 13:00:00
- end_atdate & time
- 2022-08-07 13:24:45
- reason_codetext
- T78.40XA
- total_costdecimal
- 175.6
- payer_paiddecimal
- 159.38
- encounter_idnumber · unique id
- 2
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 4
- encounter_classtext
- telehealth
- start_atdate & time
- 2022-10-12 11:15:00
- end_atdate & time
- 2022-10-12 11:59:48
- reason_codetext
- E11.9
- total_costdecimal
- 110.02
- payer_paiddecimal
- 95.53
- encounter_idnumber · unique id
- 3
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 74
- encounter_classtext
- telehealth
- start_atdate & time
- 2023-05-12 11:30:00
- end_atdate & time
- 2023-05-12 12:13:27
- reason_codetext
- E11.9
- total_costdecimal
- 83.68
- payer_paiddecimal
- 74.77
- encounter_idnumber · unique id
- 4
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 349
- encounter_classtext
- ambulatory
- start_atdate & time
- 2023-12-17 08:15:00
- end_atdate & time
- 2023-12-17 08:39:33
- reason_codetext
- E11.9
- total_costdecimal
- 198.23
- payer_paiddecimal
- 187.3
- encounter_idnumber · unique id
- 5
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 4
- encounter_classtext
- telehealth
- start_atdate & time
- 2024-05-09 16:45:00
- end_atdate & time
- 2024-05-09 17:29:01
- reason_codetext
- E66.9
- total_costdecimal
- 115.08
- payer_paiddecimal
- 98.4
- encounter_idnumber · unique id
- 6
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 4
- encounter_classtext
- ambulatory
- start_atdate & time
- 2024-09-07 13:00:00
- end_atdate & time
- 2024-09-07 13:27:30
- reason_codetext
- E66.9
- total_costdecimal
- 153.61
- payer_paiddecimal
- 142.99
- encounter_idnumber · unique id
- 7
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 4
- encounter_classtext
- ambulatory
- start_atdate & time
- 2025-03-21 14:45:00
- end_atdate & time
- 2025-03-21 15:06:04
- reason_codetext
- E66.9
- total_costdecimal
- 205.8
- payer_paiddecimal
- 186.35
- encounter_idnumber · unique id
- 8
- patient_idnumber · links to patients
- 1
- provider_idnumber · links to providers
- 347
- encounter_classtext
- urgent_care
- start_atdate & time
- 2025-04-13 19:00:00
- end_atdate & time
- 2025-04-13 19:56:05
- reason_codetext
- U07.1
- total_costdecimal
- 271.26
- payer_paiddecimal
- 249.02
- encounter_idnumber · unique id
- 9
- patient_idnumber · links to patients
- 2
- provider_idnumber · links to providers
- 309
- encounter_classtext
- ambulatory
- start_atdate & time
- 2022-09-03 12:30:00
- end_atdate & time
- 2022-09-03 12:53:18
- reason_codetext
- K21.9
- total_costdecimal
- 207.99
- payer_paiddecimal
- 159.16
- encounter_idnumber · unique id
- 10
- patient_idnumber · links to patients
- 2
- provider_idnumber · links to providers
- 309
- encounter_classtext
- ambulatory
- start_atdate & time
- 2022-12-17 14:30:00
- end_atdate & time
- 2022-12-17 14:56:24
- reason_codetext
- J02.9
- total_costdecimal
- 165.38
- payer_paiddecimal
- 129.81
first 10 of 20,447 rows · your queries use all of them
observations8 columns · 39,529 rows
| observation_idnumber · unique id | patient_idnumber · links to patients | encounter_idnumber · links to encounters | observed_atdate & time | codetext | descriptiontext | valuedecimal | unittext |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 2022-08-07 13:18:00 | BP_SYS | Systolic blood pressure | 126 | mmHg |
| 2 | 1 | 1 | 2022-08-07 13:05:00 | BP_DIA | Diastolic blood pressure | 79 | mmHg |
| 3 | 1 | 2 | 2022-10-12 11:50:00 | A1C | Hemoglobin A1c | 5.96 | % |
| 4 | 1 | 3 | 2023-05-12 12:02:00 | A1C | Hemoglobin A1c | 6.06 | % |
| 5 | 1 | 4 | 2023-12-17 08:40:00 | BP_SYS | Systolic blood pressure | 122 | mmHg |
| 6 | 1 | 4 | 2023-12-17 08:33:00 | BP_DIA | Diastolic blood pressure | 71 | mmHg |
| 7 | 1 | 4 | 2023-12-17 08:33:00 | HR | Heart rate | 76 | beats/min |
| 8 | 1 | 4 | 2023-12-17 08:26:00 | A1C | Hemoglobin A1c | 6.66 | % |
| 9 | 1 | 8 | 2025-04-13 19:26:00 | BP_SYS | Systolic blood pressure | 129 | mmHg |
| 10 | 1 | 8 | 2025-04-13 19:17:00 | BP_DIA | Diastolic blood pressure | 80 | mmHg |
- observation_idnumber · unique id
- 1
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 1
- observed_atdate & time
- 2022-08-07 13:18:00
- codetext
- BP_SYS
- descriptiontext
- Systolic blood pressure
- valuedecimal
- 126
- unittext
- mmHg
- observation_idnumber · unique id
- 2
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 1
- observed_atdate & time
- 2022-08-07 13:05:00
- codetext
- BP_DIA
- descriptiontext
- Diastolic blood pressure
- valuedecimal
- 79
- unittext
- mmHg
- observation_idnumber · unique id
- 3
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 2
- observed_atdate & time
- 2022-10-12 11:50:00
- codetext
- A1C
- descriptiontext
- Hemoglobin A1c
- valuedecimal
- 5.96
- unittext
- %
- observation_idnumber · unique id
- 4
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 3
- observed_atdate & time
- 2023-05-12 12:02:00
- codetext
- A1C
- descriptiontext
- Hemoglobin A1c
- valuedecimal
- 6.06
- unittext
- %
- observation_idnumber · unique id
- 5
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 4
- observed_atdate & time
- 2023-12-17 08:40:00
- codetext
- BP_SYS
- descriptiontext
- Systolic blood pressure
- valuedecimal
- 122
- unittext
- mmHg
- observation_idnumber · unique id
- 6
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 4
- observed_atdate & time
- 2023-12-17 08:33:00
- codetext
- BP_DIA
- descriptiontext
- Diastolic blood pressure
- valuedecimal
- 71
- unittext
- mmHg
- observation_idnumber · unique id
- 7
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 4
- observed_atdate & time
- 2023-12-17 08:33:00
- codetext
- HR
- descriptiontext
- Heart rate
- valuedecimal
- 76
- unittext
- beats/min
- observation_idnumber · unique id
- 8
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 4
- observed_atdate & time
- 2023-12-17 08:26:00
- codetext
- A1C
- descriptiontext
- Hemoglobin A1c
- valuedecimal
- 6.66
- unittext
- %
- observation_idnumber · unique id
- 9
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 8
- observed_atdate & time
- 2025-04-13 19:26:00
- codetext
- BP_SYS
- descriptiontext
- Systolic blood pressure
- valuedecimal
- 129
- unittext
- mmHg
- observation_idnumber · unique id
- 10
- patient_idnumber · links to patients
- 1
- encounter_idnumber · links to encounters
- 8
- observed_atdate & time
- 2025-04-13 19:17:00
- codetext
- BP_DIA
- descriptiontext
- Diastolic blood pressure
- valuedecimal
- 80
- unittext
- mmHg
first 10 of 39,529 rows · your queries use all of them
solution.sql
Output
Hints and the answer are always available. Using them counts the question as solved with help.