runtime
78 / 139

task NULL handling · easy

Debug: find measurements with no value

The query should return observation_id and code for observations whose value was not obtained, but it returns nothing. Fix it.

what to return

Columns
observation_idcode in this order
Rows
401 rows · any order
Skill
Repair the query’s logic and confirm the fix on changed data. Refresher: Understand NULL →

expected result

Your query should return exactly these columns and values. Run it and compare.

expected result401 rows · any order
observation_idcode
18BP_SYS
24BP_SYS
45BP_SYS

first 3 of 401 rows

data you can query

Healthcare dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.

observations8 columns · 39,529 rows
observation_idnumber · unique idpatient_idnumber · links to patientsencounter_idnumber · links to encountersobserved_atdate & timecodetextdescriptiontextvaluedecimalunittext
1112022-08-07 13:18:00BP_SYSSystolic blood pressure126mmHg
2112022-08-07 13:05:00BP_DIADiastolic blood pressure79mmHg
3122022-10-12 11:50:00A1CHemoglobin A1c5.96%
4132023-05-12 12:02:00A1CHemoglobin A1c6.06%
5142023-12-17 08:40:00BP_SYSSystolic blood pressure122mmHg
6142023-12-17 08:33:00BP_DIADiastolic blood pressure71mmHg
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

first 6 of 39,529 rows · your queries use all of them

solution.sql
 

Hints and the answer are always available. Using them counts the question as solved with help.

Debug: find measurements with no value — SQL practice · Runtime