human
Schema:
Allergy_Type (Allergy, AllergyType)
Has_Allergy (StuID, Allergy)
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Please answer with SQL.
assistant
Sure, I understand.
human
Show first name and last name for all students.
assistant
SELECT Fname , Lname FROM Student
human
How many different advisors are listed?
assistant
SELECT count(DISTINCT advisor) FROM Student
human
What is the last name of the youngest student?
assistant
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
human
Show all advisors and corresponding number of students.
assistant
SELECT advisor , count(*) FROM Student GROUP BY advisor
human
Which advisor has most number of students?
assistant
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
human
Who advises student 1004?
assistant
SELECT Advisor FROM Student WHERE StuID = 1004 ;