I am not able to understand how to link the table? Can someone explain me please.
For this particular question my query statement was
"SELECT ROOMS.ID, MIN(CAPACITY) * 7, STUDENTS.GRADE FROM ROOMS JOIN CLASSES ON ROOMS.ID = CLASSES.ROOM_ID JOIN SCHEDULE ON CLASSES.ID = SCHEDULE.CLASS_ID JOIN STUDENTS ON STUDENTS.ID = SCHEDULE.STUDENT_ID WHERE GRADE = 6;"
Can someone explain me where i am wrong. Thanks
Steven Parker176,321 Points
You're constraining the value by including tables not needed for this query. In particular, you don't need SCHEDULE or STUDENTS since we're not concerned with any specific student or time of day. But JOIN SUBJECTS instead (as the reference to GRADE) and you'll get the correct result.
SELECT ROOMS.ID, MIN(CAPACITY) * 7, GRADE FROM ROOMS JOIN CLASSES ON ROOMS.ID = CLASSES.ROOM_ID JOIN SUBJECTS ON SUBJECTS.ID = CLASSES.SUBJECT_ID WHERE GRADE = 6