human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Video_Games (GameID, GName, GType)
Plays_Games (StuID, GameID, Hours_Played)
SportsInfo (StuID, SportName, HoursPerWeek, GamesPlayed, OnScholarship)
Please answer with SQL.
assistant
Sure, I understand.
human
Which game type has least number of games?
assistant
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) LIMIT 1
human
Which game type has most number of games?
assistant
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) DESC LIMIT 1
human
How many games are played for all football games by students on scholarship?
assistant
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = 'Football' AND onscholarship = 'Y'
human
How many students play sports?
assistant
SELECT count(DISTINCT StuID) FROM Sportsinfo
human
How many students play video games?
assistant
SELECT count(DISTINCT StuID) FROM Plays_games
human
How many games are played for all students?
assistant
SELECT SUM( gamesplayed ) FROM Sportsinfo ;