SQL - Quiz 4 Question Seems Wrong

I don’t think this particular question is complete and offers enough information to be answered correctly.

According to the question there are two tables: TEACHERS and STUDENTS. There is nothing that tells us the name of the columns of the tables but I will start with the following assumption especially since “Each student belongs to a a teacher”. That means for every teacher there are one or more students. This is a standard parent-child relationship between the two. That would mean that the STUDENTS table would have a foreign key to the TEACHER table’s primary key.

TEACHERS

  • id
  • name
  • etc

STUDENTS

  • id
  • name
  • teacher_id

So in order to complete the join of the two tables the provided code is missing the “INNER JOIN” or “JOIN” code, which is not provided in any of the answers. So this is what I would do to join the two tables

SELECT * FROM students INNER JOIN teachers ON teachers.id = students.teacher_id;

However, the answer that is indicated as correct is shown above:
teachers.student_id = students.id

This would mean that a TEACHER could only have 1 STUDENT. I believe the closest correct answer should be
teachers.id = students.teacher_id which would allow a teacher to have more than one student.

Hi Santiago,

It looks like this quiz question has had some changes since you made your report. If you have a chance, please check - does is look more sensible now?

1 Like

Santiagooooo is correct, although for me this question came up as 3rd of 8. Nonetheless, this question is still scoring wrong, and it’s now September 2017. The question indicates the solution is to join on the teacher id. Therefore the correct JOIN clause is as Santiagooooo showed:

JOIN teachers
ON teachers.id = students.teacher_id;

I’ve seen other errors, reported them, and they’ve gone unresolved, particularly in the HTML/CSS courses. One therefore assumes these bugs are not bugs but “features” of the site. I believe I just reluctantly decided I cannot renew any memberships to this site.