[Solved] Output student number that exists only on primary key but doesn’t exist on foreign key


This way you can select all students that are not found (by their id) in the grade table.

SELECT * 
FROM student 
WHERE id NOT IN (SELECT student_id FROM grade)

1

solved Output student number that exists only on primary key but doesn’t exist on foreign key