question
stringlengths
16
224
schema
stringlengths
142
5.86k
query
stringlengths
20
577
Which tourist attractions do the tourists Vincent and Marcelle visit? Tell me the names of the attractions.
Ref_Hotel_Star_Ratings: star_rating_code (CHAR(15)), star_rating_description (VARCHAR(80)) Locations: Location_ID (INTEGER), Location_Name (VARCHAR(255)), Address (VARCHAR(255)), Other_Details (VARCHAR(255)) Ref_Attraction_Types: Attraction_Type_Code (CHAR(15)), Attraction_Type_Description (VARCHAR(255)) Visitors: Tourist_ID (INTEGER), Tourist_Details (VARCHAR(255)) Features: Feature_ID (INTEGER), Feature_Details (VARCHAR(255)) Hotels: hotel_id (INTEGER), star_rating_code (CHAR(15)), pets_allowed_yn (CHAR(1)), price_range (REAL), other_hotel_details (VARCHAR(255)) Tourist_Attractions: Tourist_Attraction_ID (INTEGER), Attraction_Type_Code (CHAR(15)), Location_ID (INTEGER), How_to_Get_There (VARCHAR(255)), Name (VARCHAR(255)), Description (VARCHAR(255)), Opening_Hours (VARCHAR(255)), Other_Details (VARCHAR(255)) Street_Markets: Market_ID (INTEGER), Market_Details (VARCHAR(255)) Shops: Shop_ID (INTEGER), Shop_Details (VARCHAR(255)) Museums: Museum_ID (INTEGER), Museum_Details (VARCHAR(255)) Royal_Family: Royal_Family_ID (INTEGER), Royal_Family_Details (VARCHAR(255)) Theme_Parks: Theme_Park_ID (INTEGER), Theme_Park_Details (VARCHAR(255)) Visits: Visit_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Tourist_ID (INTEGER), Visit_Date (DATETIME), Visit_Details (VARCHAR(40)) Photos: Photo_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(255)), Description (VARCHAR(255)), Filename (VARCHAR(255)), Other_Details (VARCHAR(255)) Staff: Staff_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(40)), Other_Details (VARCHAR(255)) Tourist_Attraction_Features: Tourist_Attraction_ID (INTEGER), Feature_ID (INTEGER)
SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Marcelle"
What are the names of tourist attraction that Alison visited but Rosalind did not visit?
Ref_Hotel_Star_Ratings: star_rating_code (CHAR(15)), star_rating_description (VARCHAR(80)) Locations: Location_ID (INTEGER), Location_Name (VARCHAR(255)), Address (VARCHAR(255)), Other_Details (VARCHAR(255)) Ref_Attraction_Types: Attraction_Type_Code (CHAR(15)), Attraction_Type_Description (VARCHAR(255)) Visitors: Tourist_ID (INTEGER), Tourist_Details (VARCHAR(255)) Features: Feature_ID (INTEGER), Feature_Details (VARCHAR(255)) Hotels: hotel_id (INTEGER), star_rating_code (CHAR(15)), pets_allowed_yn (CHAR(1)), price_range (REAL), other_hotel_details (VARCHAR(255)) Tourist_Attractions: Tourist_Attraction_ID (INTEGER), Attraction_Type_Code (CHAR(15)), Location_ID (INTEGER), How_to_Get_There (VARCHAR(255)), Name (VARCHAR(255)), Description (VARCHAR(255)), Opening_Hours (VARCHAR(255)), Other_Details (VARCHAR(255)) Street_Markets: Market_ID (INTEGER), Market_Details (VARCHAR(255)) Shops: Shop_ID (INTEGER), Shop_Details (VARCHAR(255)) Museums: Museum_ID (INTEGER), Museum_Details (VARCHAR(255)) Royal_Family: Royal_Family_ID (INTEGER), Royal_Family_Details (VARCHAR(255)) Theme_Parks: Theme_Park_ID (INTEGER), Theme_Park_Details (VARCHAR(255)) Visits: Visit_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Tourist_ID (INTEGER), Visit_Date (DATETIME), Visit_Details (VARCHAR(40)) Photos: Photo_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(255)), Description (VARCHAR(255)), Filename (VARCHAR(255)), Other_Details (VARCHAR(255)) Staff: Staff_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(40)), Other_Details (VARCHAR(255)) Tourist_Attraction_Features: Tourist_Attraction_ID (INTEGER), Feature_ID (INTEGER)
SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Alison" EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Rosalind"
Find the the names of the tourist attractions that the tourist named Alison visited but Rosalind did not visit.
Ref_Hotel_Star_Ratings: star_rating_code (CHAR(15)), star_rating_description (VARCHAR(80)) Locations: Location_ID (INTEGER), Location_Name (VARCHAR(255)), Address (VARCHAR(255)), Other_Details (VARCHAR(255)) Ref_Attraction_Types: Attraction_Type_Code (CHAR(15)), Attraction_Type_Description (VARCHAR(255)) Visitors: Tourist_ID (INTEGER), Tourist_Details (VARCHAR(255)) Features: Feature_ID (INTEGER), Feature_Details (VARCHAR(255)) Hotels: hotel_id (INTEGER), star_rating_code (CHAR(15)), pets_allowed_yn (CHAR(1)), price_range (REAL), other_hotel_details (VARCHAR(255)) Tourist_Attractions: Tourist_Attraction_ID (INTEGER), Attraction_Type_Code (CHAR(15)), Location_ID (INTEGER), How_to_Get_There (VARCHAR(255)), Name (VARCHAR(255)), Description (VARCHAR(255)), Opening_Hours (VARCHAR(255)), Other_Details (VARCHAR(255)) Street_Markets: Market_ID (INTEGER), Market_Details (VARCHAR(255)) Shops: Shop_ID (INTEGER), Shop_Details (VARCHAR(255)) Museums: Museum_ID (INTEGER), Museum_Details (VARCHAR(255)) Royal_Family: Royal_Family_ID (INTEGER), Royal_Family_Details (VARCHAR(255)) Theme_Parks: Theme_Park_ID (INTEGER), Theme_Park_Details (VARCHAR(255)) Visits: Visit_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Tourist_ID (INTEGER), Visit_Date (DATETIME), Visit_Details (VARCHAR(40)) Photos: Photo_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(255)), Description (VARCHAR(255)), Filename (VARCHAR(255)), Other_Details (VARCHAR(255)) Staff: Staff_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(40)), Other_Details (VARCHAR(255)) Tourist_Attraction_Features: Tourist_Attraction_ID (INTEGER), Feature_ID (INTEGER)
SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Alison" EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Rosalind"
How many tourists did not make any visit?
Ref_Hotel_Star_Ratings: star_rating_code (CHAR(15)), star_rating_description (VARCHAR(80)) Locations: Location_ID (INTEGER), Location_Name (VARCHAR(255)), Address (VARCHAR(255)), Other_Details (VARCHAR(255)) Ref_Attraction_Types: Attraction_Type_Code (CHAR(15)), Attraction_Type_Description (VARCHAR(255)) Visitors: Tourist_ID (INTEGER), Tourist_Details (VARCHAR(255)) Features: Feature_ID (INTEGER), Feature_Details (VARCHAR(255)) Hotels: hotel_id (INTEGER), star_rating_code (CHAR(15)), pets_allowed_yn (CHAR(1)), price_range (REAL), other_hotel_details (VARCHAR(255)) Tourist_Attractions: Tourist_Attraction_ID (INTEGER), Attraction_Type_Code (CHAR(15)), Location_ID (INTEGER), How_to_Get_There (VARCHAR(255)), Name (VARCHAR(255)), Description (VARCHAR(255)), Opening_Hours (VARCHAR(255)), Other_Details (VARCHAR(255)) Street_Markets: Market_ID (INTEGER), Market_Details (VARCHAR(255)) Shops: Shop_ID (INTEGER), Shop_Details (VARCHAR(255)) Museums: Museum_ID (INTEGER), Museum_Details (VARCHAR(255)) Royal_Family: Royal_Family_ID (INTEGER), Royal_Family_Details (VARCHAR(255)) Theme_Parks: Theme_Park_ID (INTEGER), Theme_Park_Details (VARCHAR(255)) Visits: Visit_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Tourist_ID (INTEGER), Visit_Date (DATETIME), Visit_Details (VARCHAR(40)) Photos: Photo_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(255)), Description (VARCHAR(255)), Filename (VARCHAR(255)), Other_Details (VARCHAR(255)) Staff: Staff_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(40)), Other_Details (VARCHAR(255)) Tourist_Attraction_Features: Tourist_Attraction_ID (INTEGER), Feature_ID (INTEGER)
SELECT count(*) FROM Visitors WHERE Tourist_ID NOT IN ( SELECT Tourist_ID FROM Visits )
Count the number of tourists who did not visit any place.
Ref_Hotel_Star_Ratings: star_rating_code (CHAR(15)), star_rating_description (VARCHAR(80)) Locations: Location_ID (INTEGER), Location_Name (VARCHAR(255)), Address (VARCHAR(255)), Other_Details (VARCHAR(255)) Ref_Attraction_Types: Attraction_Type_Code (CHAR(15)), Attraction_Type_Description (VARCHAR(255)) Visitors: Tourist_ID (INTEGER), Tourist_Details (VARCHAR(255)) Features: Feature_ID (INTEGER), Feature_Details (VARCHAR(255)) Hotels: hotel_id (INTEGER), star_rating_code (CHAR(15)), pets_allowed_yn (CHAR(1)), price_range (REAL), other_hotel_details (VARCHAR(255)) Tourist_Attractions: Tourist_Attraction_ID (INTEGER), Attraction_Type_Code (CHAR(15)), Location_ID (INTEGER), How_to_Get_There (VARCHAR(255)), Name (VARCHAR(255)), Description (VARCHAR(255)), Opening_Hours (VARCHAR(255)), Other_Details (VARCHAR(255)) Street_Markets: Market_ID (INTEGER), Market_Details (VARCHAR(255)) Shops: Shop_ID (INTEGER), Shop_Details (VARCHAR(255)) Museums: Museum_ID (INTEGER), Museum_Details (VARCHAR(255)) Royal_Family: Royal_Family_ID (INTEGER), Royal_Family_Details (VARCHAR(255)) Theme_Parks: Theme_Park_ID (INTEGER), Theme_Park_Details (VARCHAR(255)) Visits: Visit_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Tourist_ID (INTEGER), Visit_Date (DATETIME), Visit_Details (VARCHAR(40)) Photos: Photo_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(255)), Description (VARCHAR(255)), Filename (VARCHAR(255)), Other_Details (VARCHAR(255)) Staff: Staff_ID (INTEGER), Tourist_Attraction_ID (INTEGER), Name (VARCHAR(40)), Other_Details (VARCHAR(255)) Tourist_Attraction_Features: Tourist_Attraction_ID (INTEGER), Feature_ID (INTEGER)
SELECT count(*) FROM Visitors WHERE Tourist_ID NOT IN ( SELECT Tourist_ID FROM Visits )
How many video games exist?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(*) FROM Video_games
How many video games do you have?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(*) FROM Video_games
How many video game types exist?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT gtype) FROM Video_games
What is the count of different game types?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT gtype) FROM Video_games
Show all video game types.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT DISTINCT gtype FROM Video_games
What are the different types of video games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT DISTINCT gtype FROM Video_games
Show all video games and their types in the order of their names.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname , gtype FROM Video_games ORDER BY gname
What are the names of all the video games and their types in alphabetical order?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname , gtype FROM Video_games ORDER BY gname
Show all video games with type Collectible card game.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname FROM Video_games WHERE gtype = "Collectible card game"
What are the names of all video games that are collectible cards?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname FROM Video_games WHERE gtype = "Collectible card game"
What is the type of video game Call of Destiny.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype FROM Video_games WHERE gname = "Call of Destiny"
What type of game is Call of Destiny?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype FROM Video_games WHERE gname = "Call of Destiny"
How many video games have type Massively multiplayer online game?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(*) FROM Video_games WHERE gtype = "Massively multiplayer online game"
Count the number of video games with Massively multiplayer online game type .
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(*) FROM Video_games WHERE gtype = "Massively multiplayer online game"
Show all video game types and the number of video games in each type.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype , count(*) FROM Video_games GROUP BY gtype
What are the types of video games and how many are in each type?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype , count(*) FROM Video_games GROUP BY gtype
Which game type has most number of games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) DESC LIMIT 1
What type has the most games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) DESC LIMIT 1
Which game type has least number of games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) LIMIT 1
What is the type with the fewest games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) LIMIT 1
Show ids for all students who live in CHI.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE city_code = "CHI"
What are the ids of all students who live in CHI?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE city_code = "CHI"
Show ids for all students who have advisor 1121.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE Advisor = 1121
What are the ids of all students who have advisor number 1121?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE Advisor = 1121
Show first name for all students with major 600.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT Fname FROM Student WHERE Major = 600
What are the first names for all students who are from the major numbered 600?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT Fname FROM Student WHERE Major = 600
Show the average, minimum, and maximum age for different majors.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT major , avg(age) , min(age) , max(age) FROM Student GROUP BY major
What are the average, minimum, and max ages for each of the different majors?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT major , avg(age) , min(age) , max(age) FROM Student GROUP BY major
Show all advisors who have at least two students.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT advisor FROM Student GROUP BY advisor HAVING count(*) >= 2
What are the advisors
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT advisor FROM Student GROUP BY advisor HAVING count(*) >= 2
How many sports do we have?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT sportname) FROM Sportsinfo
How many different types of sports do we offer?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT sportname) FROM Sportsinfo
How many students play sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT StuID) FROM Sportsinfo
How many different students are involved in sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT StuID) FROM Sportsinfo
List ids for all student who are on scholarship.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
What are the ids for all sporty students who are on scholarship?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
Show last names for all student who are on scholarship.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
What are the last names for all scholarship students?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
How many games are played for all students?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(gamesplayed) FROM Sportsinfo
What is the total number of games played?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(gamesplayed) FROM Sportsinfo
How many games are played for all football games by students on scholarship?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
What is the total number of all football games played by scholarship students?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
Show all sport name and the number of students.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
How many students play each sport?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname
Show all student IDs with the number of sports and total number of games played
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
What are the ids of all students along with how many sports and games did they play?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
Show all student IDs with more than total 10 hours per week on all sports played.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10
What are the student IDs for everybody who worked for more than 10 hours per week on all sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10
What is the first name and last name of the student who have most number of sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
What is the first and last name of the student who played the most sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
Which sport has most number of students on scholarship?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
What is the sport with the most scholarship students?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
Show student ids who don't have any sports.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
What are the ids of all students who don't play sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
Show student ids who are on scholarship and have major 600.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
What are the student ids for those on scholarship in major number 600?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE major = 600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y'
Show student ids who are female and play football.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
What are the ids of all female students who play football?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE sex = 'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
Show all male student ids who don't play football.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
What are the ids of all male students who do not play football?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student WHERE sex = 'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname = "Football"
Show total hours per week and number of games played for student David Shieber.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber"
What is the total number of hours per work and number of games played by David Shieber?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = "David" AND T2.Lname = "Shieber"
Show total hours per week and number of games played for students under 20.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
What is the total number of hours per week and number of games played by students under 20?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.age < 20
How many students play video games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT StuID) FROM Plays_games
How many different students play games?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT count(DISTINCT StuID) FROM Plays_games
Show ids of students who don't play video game.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
What are the ids of all students who are not video game players?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
Show ids of students who play video game and play sports.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
What are the ids of all students who played video games and sports?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
Show all game ids and the number of hours played.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid
What are ids and total number of hours played for each game?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid
Show all student ids and the number of hours played.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT Stuid , sum(hours_played) FROM Plays_games GROUP BY Stuid
What are the ids of all students and number of hours played?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT Stuid , sum(hours_played) FROM Plays_games GROUP BY Stuid
Show the game name that has most number of hours played.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
What is the name of the game that has been played the most?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
Show all game names played by at least 1000 hours.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING sum(hours_played) >= 1000
What are the names of all the games that have been played for at least 1000 hours?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid HAVING sum(hours_played) >= 1000
Show all game names played by Linda Smith
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda"
What are the names of all games played by Linda Smith?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = "Smith" AND T3.Fname = "Linda"
Find the last and first name of students who are playing Football or Lacrosse.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT T2.lname , T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse"
What is the first and last name of all students who play Football or Lacrosse?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT T2.lname , T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.SportName = "Football" OR T1.SportName = "Lacrosse"
Find the first name and age of the students who are playing both Football and Lacrosse.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT fname , age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
What are the first names and ages of all students who are playing both Football and Lacrosse?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT fname , age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName = "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName = "Lacrosse")
Find the last name and gender of the students who are playing both Call of Destiny and Works of Widenius games.
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT lname , sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius")
what is the last name and gender of all students who played both Call of Destiny and Works of Widenius?
Student: StuID (INTEGER), LName (VARCHAR(12)), Fname (VARCHAR(12)), Age (INTEGER), Sex (VARCHAR(1)), Major (INTEGER), Advisor (INTEGER), city_code (VARCHAR(3)) Video_Games: GameID (INTEGER), GName (VARCHAR(40)), GType (VARCHAR(40)) Plays_Games: StuID (INTEGER), GameID (INTEGER), Hours_Played (INTEGER) SportsInfo: StuID (INTEGER), SportName (VARCHAR(32)), HoursPerWeek (INTEGER), GamesPlayed (INTEGER), OnScholarship (VARCHAR(1))
SELECT lname , sex FROM Student WHERE StuID IN (SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Call of Destiny" INTERSECT SELECT T1.StuID FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.GameID = T2.GameID WHERE T2.Gname = "Works of Widenius")
Find the name of all customers.
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT customer_name FROM customers
What are the names of all the customers?
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT customer_name FROM customers
How many customers are there?
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT count(*) FROM customers
Return the total number of distinct customers.
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT count(*) FROM customers
What is the average amount of items ordered in each order?
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT avg(order_quantity) FROM order_items
Find the average order quantity per order.
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT avg(order_quantity) FROM order_items
What are the names of customers who use payment method "Cash"?
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT customer_name FROM customers WHERE payment_method = "Cash"
Which customers use "Cash" for payment method? Return the customer names.
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT customer_name FROM customers WHERE payment_method = "Cash"
Find the "date became customers" of the customers whose ID is between 10 and 20.
Addresses: address_id (INTEGER), address_content (VARCHAR(80)), city (VARCHAR(50)), zip_postcode (VARCHAR(20)), state_province_county (VARCHAR(50)), country (VARCHAR(50)), other_address_details (VARCHAR(255)) Products: product_id (INTEGER), product_details (VARCHAR(255)) Customers: customer_id (INTEGER), payment_method (VARCHAR(15)), customer_name (VARCHAR(80)), date_became_customer (DATETIME), other_customer_details (VARCHAR(255)) Customer_Addresses: customer_id (INTEGER), address_id (INTEGER), date_address_from (DATETIME), address_type (VARCHAR(15)), date_address_to (DATETIME) Customer_Contact_Channels: customer_id (INTEGER), channel_code (VARCHAR(15)), active_from_date (DATETIME), active_to_date (DATETIME), contact_number (VARCHAR(50)) Customer_Orders: order_id (INTEGER), customer_id (INTEGER), order_status (VARCHAR(15)), order_date (DATETIME), order_details (VARCHAR(255)) Order_Items: order_id (INTEGER), product_id (INTEGER), order_quantity (VARCHAR(15))
SELECT date_became_customer FROM customers WHERE customer_id BETWEEN 10 AND 20