Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Query for Patient Condition

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL Query for Patient Condition. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Boston Children's Hospital analysts use a de-identified clinical data warehouse to prepare condition-specific patient cohorts. Write a PostgreSQL query to extract patients whose recorded primary condition is Asthma.

Requirements

  1. Return the patient ID, patient name, date of birth, and primary condition.
  2. Include only exact matches for primary_condition = 'Asthma', and order the results by patient_id ascending.

Schema

patients
ColumnTypeDescription
patient_idPKINTEGERUnique de-identified patient identifier
patient_nameVARCHAR(100)De-identified patient name
date_of_birthDATEPatient date of birth
primary_conditionVARCHAR(100)Recorded primary medical condition
Tablespatients
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results