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
SELECT column1, column2, ... FROM table_name 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:
SELECT appointment_id, doctor_id, appointment_date FROM Appointments 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):
SELECT Doctors.first_name, Doctors.last_name, Appointments.appointment_date FROM Doctors JOIN Appointments ON Doctors.doctor_id = Appointments.doctor_id WHERE Appointments.doctor_id IS NOT NULL;
