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
How many visits did Subway receive?
assistant
SELECT COUNT( * ) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Restaurant.ResName = 'Subway' ;
human
Give the student ids for these visits.
assistant
SELECT StuID FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Restaurant.ResName = "Subway" ;