human
Schema:
Activity (actid, activity_name)
Participates_in (stuid, actid)
Faculty_Participates_in (FacID, actid)
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Faculty (FacID, Lname, Fname, Rank, Sex, Phone, Room, Building)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the student ids.
assistant
SELECT StuID FROM Student;
human
Also show the ranks of their advisors.
assistant
SELECT T2.StuID , T1.rank FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor;
human
Show the student id for those whose advisors are professors?
assistant
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor" ;