Bird
0
0

Given tables Students (StudentID primary key) and Enrollments (StudentID foreign key), what will this query return?

medium📝 query result Q4 of 15
SQL - INNER JOIN
Given tables Students (StudentID primary key) and Enrollments (StudentID foreign key), what will this query return?
SELECT Students.Name, Enrollments.Course FROM Students JOIN Enrollments ON Students.StudentID = Enrollments.StudentID;
AList of all students without courses
BEmpty result set
CList of all courses without student names
DList of student names with their enrolled courses
Step-by-Step Solution
Solution:
  1. Step 1: Understand join condition

    The join matches Students.StudentID with Enrollments.StudentID, linking students to their courses.
  2. Step 2: Analyze SELECT columns

    It selects student names and their courses from matching rows.
  3. Final Answer:

    List of student names with their enrolled courses -> Option D
  4. Quick Check:

    Join on keys returns matching student-course pairs [OK]
Quick Trick: Join returns matching rows with related data [OK]
Common Mistakes:
MISTAKES
  • Expecting unmatched students to appear
  • Confusing columns selected
  • Assuming empty result without data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes