|
sql / php
In a paractice exam, the question is:
select fname,lname
from student
where student_id in
(select sid
from registration
where iid in
(select instructor_id
from faculty
where fname="dumbledore"))
restate the query as a join operation in sql.
VERY new, would like to see how a pro does it. Knowing nothing about joins yet, here is my try:
select student.fname,student.lname,student.student_id
registration.sid,registration.iid,
faculty.instructor_id, faculty.fname
from student,
faculty join registration on
faculty.instructor_id = registration.iid
join student on
student.student_id = registration.sid
where faculty.fname="dumbledore"
please tell me what is wrong with this and how to fix it.
~elohmrow
|