Join Students and Enrollments
Given a students table and an enrollments table linked by student_id, write a query using INNER JOIN to display each student's name alongside their enrolled course.
Approach: create both tables, insert the given rows, then JOIN students to enrollments by matching students.id to enrollments.student_id.
Input: First line: the number of students n. Next n lines: id,name. Then: the number of enrollments m. Next m lines: student_id,course.
Output: One line per matched enrollment: a tuple (name, course), ordered by student id.
2 1,Aditi 2,Rohan 2 1,Computer Science 2,Data Science
('Aditi', 'Computer Science')
('Rohan', 'Data Science')- 1 <= n, m <= 1000
Hint 1
INNER JOIN enrollments ON students.id = enrollments.student_id links each student to their matching enrollment row(s).
Hint 2
SELECT students.name, enrollments.course picks just the two columns you need from the joined result.
Hint 3
Add ORDER BY students.id for a predictable, repeatable row order.
INNER JOIN enrollments ON students.id = enrollments.student_id lines up every enrollment with its matching student by comparing the two id columns, and SELECT students.name, enrollments.course pulls out just the pair you need from each matched row. ORDER BY students.id keeps the result order predictable and matched to input order.