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
Hello! Can you provide me with the time spent in all restaurants by Linda Smith?
assistant
SELECT SUM( Spent ) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith';
human
Are there any other students with the same city code as Linda Smith?
assistant
SELECT * FROM Student WHERE city_code = ( SELECT city_code FROM student WHERE Fname = "Linda" AND Lname = "Smith" ) AND Fname ! = "Linda" AND Lname ! = "Smith" ;