SQL IS NOT NULL Keyword
The IS NOT NULL condition checks for columns that have actual values—not empty or missing. This is helpful when filtering only complete records or valid references.
SQL IS NOT NULL Syntax
SQL
x
1
SELECT column1, column2, ...
2
FROM table_name
3
WHERE column_name IS NOT NULL;
SQL IS NOT NULL Appointments with Doctor Example
This query returns all appointments that are linked to a doctor:
SQL
1
1
SELECT appointment_id, doctor_id, appointment_date
2
FROM Appointments
3
WHERE doctor_id IS NOT NULL;

SQL IS NOT NULL with JOIN Example
This query returns doctor names and their assigned appointments (only if doctor_id is present):
SQL
1
1
SELECT Doctors.first_name, Doctors.last_name, Appointments.appointment_date
2
FROM Doctors
3
JOIN Appointments ON Doctors.doctor_id = Appointments.doctor_id
4
WHERE Appointments.doctor_id IS NOT NULL;
