🔥 SQL Interview Question of the Day
📌 Scenario:
A university wants to find students who have never enrolled in any course.
You have two tables:
students
• student_id
• student_name
enrollments
• enrollment_id
• student_id
• course_id
🎯 Task:
Find all students who have never enrolled in any course.
☑ Solution:
SELECT
s.student_id,
s.student_name
FROM students s
LEFT JOIN enrollments e
ON s.student_id = e.student_id
WHERE e.student_id IS NULL;
💡 Concept Tested:
LEFT JOIN + NULL Filtering (Finding Missing Records)
❤️ React if you want more SQL interview questions.
Post #2404
1.34K
- ❤ 5