Olawale Ahmed Alamu
1 min readNov 5, 2022

SQL Daily Practice — Day 2

We do not have all day. Time and tide wait for no man.

Let’s dive straight into today’s question which is the 2nd EASY tag question on SQL-practice-dot-com.

QUESTION: Show the first name and last name of patients who do not have allergies (null).

PROBLEM ANALYSIS: We are to output the first name and last name of all patients with no allergies, i.e where the allergy field is empty or null.

The patients' table has the following columns:

patient_id INT
first_name TEXT
last_name TEXT
gender CHAR(1)
birth_date DATE
city TEXT
province_id CHAR(2)
allergies TEXT
height INT
weight INT

SOLUTION: We write a SELECT statement to generate a first name and last name couple with a WHERE clause to restrict the selection to only those without allergies (IS NULL)

SQL SCRIPT:
 — — — — — —
SELECT first_name, last_name
FROM patients
WHERE allergies IS NULL;

— — — — — —

Follow Olawale Ahmed Alamu and #SQLDailyPractice for daily updates.

Practice SQL at https://sql-practice.com

#sql #databases #dataanalytics

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Olawale Ahmed Alamu
Olawale Ahmed Alamu

Written by Olawale Ahmed Alamu

CS Grad | Power BI | Microsoft Excel | Learning and Teaching SQL Daily

Responses (1)

Write a response