Problem Description –
Write an SQL query to find the id and the name of all students who are enrolled in departments that no longer exist.
Return the result table in any order.
The query result format is in the following example.
Difficulty Level – Easy
Problem Link – Invalid Department
SELECT id, name FROM Students WHERE department_id NOT IN (SELECT id FROM Departments)