Thread: sql / php
View Single Post
Old 11-13-2005, 08:00 PM   #1 (permalink)
elohmrow
Registered User
 
Join Date: Nov 2005
Posts: 3
elohmrow is on a distinguished road
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
elohmrow is offline   Reply With Quote