Complete the code to select all columns from the junction table named 'student_courses'.
SELECT [1] FROM student_courses;The asterisk (*) selects all columns from the table.
Complete the code to join 'students' and 'student_courses' on the student ID.
SELECT students.name, student_courses.course_id FROM students JOIN student_courses ON students.[1] = student_courses.student_id;The 'students' table's primary key is usually 'id', which matches 'student_id' in the junction table.
Fix the error in the query to get course names for each student by joining all three tables.
SELECT students.name, courses.name FROM students JOIN student_courses ON students.id = student_courses.student_id JOIN courses ON courses.[1] = student_courses.course_id;The 'courses' table's primary key is 'id', which matches 'course_id' in the junction table.
Fill both blanks to create a junction table named 'author_books' with foreign keys to 'authors' and 'books'.
CREATE TABLE author_books (author_id INT, book_id INT, FOREIGN KEY (author_id) REFERENCES [1](id), FOREIGN KEY (book_id) REFERENCES [2](id));
The junction table references the primary keys of 'authors' and 'books' tables.
Fill all three blanks to select student names and their course names using joins on the junction table.
SELECT [1].name, [2].name FROM [3] JOIN student_courses ON students.id = student_courses.student_id JOIN courses ON courses.id = student_courses.course_id;
The query selects from 'students' and 'courses' tables joined through 'student_courses'.