如何使用select如果我有3個表?SQL select,3表
表:
school_subject(ID_of_subject, workplace, name)
student(ID_of_student, firstName, surname, adress)
writing(ID_of_action, ID_of_sbuject, ID_of_student)
我想寫學生的名字和姓氏(按字母順序)誰擁有workplace=home
。
這可能嗎?以及如何按字母順序?
SELECT s.firstName, s.surname
FROM student S, school_subject P, writing Z
WHERE P.workplace = 'home'
AND P.ID_of_subject = Z.ID_of_subject
AND Z.ID_of_student = s.ID_of_student;