human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Restaurant (ResID, ResName, Address, Rating)
Type_Of_Restaurant (ResID, ResTypeID)
Restaurant_Type (ResTypeID, ResTypeName, ResTypeDescription)
Visits_Restaurant (StuID, ResID, Time, Spent)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the age of student Linda Smith?
assistant
SELECT Age FROM Student WHERE Fname = 'Linda' AND Lname = 'Smith';
human
List all students' first names and last names who majored in 600.
assistant
SELECT Fname , Lname FROM Student WHERE Major = 600;
human
Which student's age is older than 18 and is majoring in 600? List each student's first and last name.
assistant
SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major = 600;
human
List all female students age is older than 18 who is not majoring in 600. List students' first name and last name.
assistant
SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F';
human
Which Advisor has most of students? List advisor and the number of students.
assistant
SELECT Advisor , count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;
human
Advisor 1121 has how many students?
assistant
SELECT COUNT( * ) FROM Student WHERE Advisor = 1121 ;