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