question
stringlengths
12
244
context
stringlengths
27
489
answer
stringlengths
18
557
text
stringlengths
114
1.06k
Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female".
CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_id VARCHAR, gender_code VARCHAR)
SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female"
### Context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_id VARCHAR, gender_code VARCHAR) ### Question: Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female". ### Answer: SELECT T1.booking_start_date, T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female"
Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".
CREATE TABLE Apartment_Bookings (guest_id VARCHAR, booking_status_code VARCHAR); CREATE TABLE Guests (guest_first_name VARCHAR, guest_last_name VARCHAR, guest_id VARCHAR)
SELECT T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed"
### Context: CREATE TABLE Apartment_Bookings (guest_id VARCHAR, booking_status_code VARCHAR); CREATE TABLE Guests (guest_first_name VARCHAR, guest_last_name VARCHAR, guest_id VARCHAR) ### Question: Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed". ### Answer: SELECT T2.guest_first_name, T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed"
Show the facility codes of apartments with more than 4 bedrooms.
CREATE TABLE Apartment_Facilities (facility_code VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER)
SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4
### Context: CREATE TABLE Apartment_Facilities (facility_code VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER) ### Question: Show the facility codes of apartments with more than 4 bedrooms. ### Answer: SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4
Show the total number of rooms of all apartments with facility code "Gym".
CREATE TABLE Apartments (room_count INTEGER, apt_id VARCHAR); CREATE TABLE Apartment_Facilities (apt_id VARCHAR, facility_code VARCHAR)
SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym"
### Context: CREATE TABLE Apartments (room_count INTEGER, apt_id VARCHAR); CREATE TABLE Apartment_Facilities (apt_id VARCHAR, facility_code VARCHAR) ### Question: Show the total number of rooms of all apartments with facility code "Gym". ### Answer: SELECT SUM(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym"
Show the total number of rooms of the apartments in the building with short name "Columbus Square".
CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_short_name VARCHAR); CREATE TABLE Apartments (room_count INTEGER, building_id VARCHAR)
SELECT SUM(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = "Columbus Square"
### Context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_short_name VARCHAR); CREATE TABLE Apartments (room_count INTEGER, building_id VARCHAR) ### Question: Show the total number of rooms of the apartments in the building with short name "Columbus Square". ### Answer: SELECT SUM(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = "Columbus Square"
Show the addresses of the buildings that have apartments with more than 2 bathrooms.
CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_id VARCHAR); CREATE TABLE Apartments (building_id VARCHAR, bathroom_count INTEGER)
SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2
### Context: CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_id VARCHAR); CREATE TABLE Apartments (building_id VARCHAR, bathroom_count INTEGER) ### Question: Show the addresses of the buildings that have apartments with more than 2 bathrooms. ### Answer: SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2
Show the apartment type codes and apartment numbers in the buildings managed by "Kyle".
CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_manager VARCHAR); CREATE TABLE Apartments (apt_type_code VARCHAR, apt_number VARCHAR, building_id VARCHAR)
SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle"
### Context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_manager VARCHAR); CREATE TABLE Apartments (apt_type_code VARCHAR, apt_number VARCHAR, building_id VARCHAR) ### Question: Show the apartment type codes and apartment numbers in the buildings managed by "Kyle". ### Answer: SELECT T2.apt_type_code, T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle"
Show the booking status code and the corresponding number of bookings.
CREATE TABLE Apartment_Bookings (booking_status_code VARCHAR)
SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
### Context: CREATE TABLE Apartment_Bookings (booking_status_code VARCHAR) ### Question: Show the booking status code and the corresponding number of bookings. ### Answer: SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
Return all the apartment numbers sorted by the room count in ascending order.
CREATE TABLE Apartments (apt_number VARCHAR, room_count VARCHAR)
SELECT apt_number FROM Apartments ORDER BY room_count
### Context: CREATE TABLE Apartments (apt_number VARCHAR, room_count VARCHAR) ### Question: Return all the apartment numbers sorted by the room count in ascending order. ### Answer: SELECT apt_number FROM Apartments ORDER BY room_count
Return the apartment number with the largest number of bedrooms.
CREATE TABLE Apartments (apt_number VARCHAR, bedroom_count VARCHAR)
SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
### Context: CREATE TABLE Apartments (apt_number VARCHAR, bedroom_count VARCHAR) ### Question: Return the apartment number with the largest number of bedrooms. ### Answer: SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.
CREATE TABLE Apartments (apt_type_code VARCHAR)
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
### Context: CREATE TABLE Apartments (apt_type_code VARCHAR) ### Question: Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. ### Answer: SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
Show the top 3 apartment type codes sorted by the average number of rooms in descending order.
CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER)
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3
### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER) ### Question: Show the top 3 apartment type codes sorted by the average number of rooms in descending order. ### Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3
Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.
CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count VARCHAR, bedroom_count VARCHAR, room_count INTEGER)
SELECT apt_type_code, bathroom_count, bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY SUM(room_count) DESC LIMIT 1
### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count VARCHAR, bedroom_count VARCHAR, room_count INTEGER) ### Question: Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms. ### Answer: SELECT apt_type_code, bathroom_count, bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY SUM(room_count) DESC LIMIT 1
Show the most common apartment type code.
CREATE TABLE Apartments (apt_type_code VARCHAR)
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1
### Context: CREATE TABLE Apartments (apt_type_code VARCHAR) ### Question: Show the most common apartment type code. ### Answer: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show the most common apartment type code among apartments with more than 1 bathroom.
CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count INTEGER)
SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1
### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count INTEGER) ### Question: Show the most common apartment type code among apartments with more than 1 bathroom. ### Answer: SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY COUNT(*) DESC LIMIT 1
Show each apartment type code, and the maximum and minimum number of rooms for each type.
CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER)
SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM Apartments GROUP BY apt_type_code
### Context: CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER) ### Question: Show each apartment type code, and the maximum and minimum number of rooms for each type. ### Answer: SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM Apartments GROUP BY apt_type_code
Show each gender code and the corresponding count of guests sorted by the count in descending order.
CREATE TABLE Guests (gender_code VARCHAR)
SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
### Context: CREATE TABLE Guests (gender_code VARCHAR) ### Question: Show each gender code and the corresponding count of guests sorted by the count in descending order. ### Answer: SELECT gender_code, COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
How many apartments do not have any facility?
CREATE TABLE Apartment_Facilities (apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR)
SELECT COUNT(*) FROM Apartments WHERE NOT apt_id IN (SELECT apt_id FROM Apartment_Facilities)
### Context: CREATE TABLE Apartment_Facilities (apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR) ### Question: How many apartments do not have any facility? ### Answer: SELECT COUNT(*) FROM Apartments WHERE NOT apt_id IN (SELECT apt_id FROM Apartment_Facilities)
Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed"
CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR); CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR)
SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"
### Context: CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR); CREATE TABLE Apartment_Bookings (apt_id VARCHAR, booking_status_code VARCHAR) ### Question: Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed" ### Answer: SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"
Show the apartment numbers of apartments with unit status availability of both 0 and 1.
CREATE TABLE View_Unit_Status (apt_id VARCHAR, available_yn VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR)
SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1
### Context: CREATE TABLE View_Unit_Status (apt_id VARCHAR, available_yn VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR) ### Question: Show the apartment numbers of apartments with unit status availability of both 0 and 1. ### Answer: SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1
How many games are held after season 2007?
CREATE TABLE game (season INTEGER)
SELECT COUNT(*) FROM game WHERE season > 2007
### Context: CREATE TABLE game (season INTEGER) ### Question: How many games are held after season 2007? ### Answer: SELECT COUNT(*) FROM game WHERE season > 2007
List the dates of games by the home team name in descending order.
CREATE TABLE game (Date VARCHAR, home_team VARCHAR)
SELECT Date FROM game ORDER BY home_team DESC
### Context: CREATE TABLE game (Date VARCHAR, home_team VARCHAR) ### Question: List the dates of games by the home team name in descending order. ### Answer: SELECT Date FROM game ORDER BY home_team DESC
List the season, home team, away team of all the games.
CREATE TABLE game (season VARCHAR, home_team VARCHAR, away_team VARCHAR)
SELECT season, home_team, away_team FROM game
### Context: CREATE TABLE game (season VARCHAR, home_team VARCHAR, away_team VARCHAR) ### Question: List the season, home team, away team of all the games. ### Answer: SELECT season, home_team, away_team FROM game
What are the maximum, minimum and average home games each stadium held?
CREATE TABLE stadium (home_games INTEGER)
SELECT MAX(home_games), MIN(home_games), AVG(home_games) FROM stadium
### Context: CREATE TABLE stadium (home_games INTEGER) ### Question: What are the maximum, minimum and average home games each stadium held? ### Answer: SELECT MAX(home_games), MIN(home_games), AVG(home_games) FROM stadium
What is the average attendance of stadiums with capacity percentage higher than 100%?
CREATE TABLE stadium (average_attendance VARCHAR, capacity_percentage INTEGER)
SELECT average_attendance FROM stadium WHERE capacity_percentage > 100
### Context: CREATE TABLE stadium (average_attendance VARCHAR, capacity_percentage INTEGER) ### Question: What is the average attendance of stadiums with capacity percentage higher than 100%? ### Answer: SELECT average_attendance FROM stadium WHERE capacity_percentage > 100
What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?
CREATE TABLE injury_accident (player VARCHAR, number_of_matches VARCHAR, SOURCE VARCHAR, injury VARCHAR)
SELECT player, number_of_matches, SOURCE FROM injury_accident WHERE injury <> 'Knee problem'
### Context: CREATE TABLE injury_accident (player VARCHAR, number_of_matches VARCHAR, SOURCE VARCHAR, injury VARCHAR) ### Question: What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'? ### Answer: SELECT player, number_of_matches, SOURCE FROM injury_accident WHERE injury <> 'Knee problem'
What is the season of the game which causes the player 'Walter Samuel' to get injured?
CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR); CREATE TABLE game (season VARCHAR, id VARCHAR)
SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'
### Context: CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR); CREATE TABLE game (season VARCHAR, id VARCHAR) ### Question: What is the season of the game which causes the player 'Walter Samuel' to get injured? ### Answer: SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'
What are the ids, scores, and dates of the games which caused at least two injury accidents?
CREATE TABLE game (id VARCHAR, score VARCHAR, date VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR)
SELECT T1.id, T1.score, T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2
### Context: CREATE TABLE game (id VARCHAR, score VARCHAR, date VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR) ### Question: What are the ids, scores, and dates of the games which caused at least two injury accidents? ### Answer: SELECT T1.id, T1.score, T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 2
What are the id and name of the stadium where the most injury accidents happened?
CREATE TABLE stadium (id VARCHAR, name VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR)
SELECT T1.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1
### Context: CREATE TABLE stadium (id VARCHAR, name VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR) ### Question: What are the id and name of the stadium where the most injury accidents happened? ### Answer: SELECT T1.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1
In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?
CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, injury VARCHAR); CREATE TABLE game (season VARCHAR, stadium_id VARCHAR, id VARCHAR)
SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'
### Context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, injury VARCHAR); CREATE TABLE game (season VARCHAR, stadium_id VARCHAR, id VARCHAR) ### Question: In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'? ### Answer: SELECT T1.season, T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'
How many different kinds of information sources are there for injury accidents?
CREATE TABLE injury_accident (SOURCE VARCHAR)
SELECT COUNT(DISTINCT SOURCE) FROM injury_accident
### Context: CREATE TABLE injury_accident (SOURCE VARCHAR) ### Question: How many different kinds of information sources are there for injury accidents? ### Answer: SELECT COUNT(DISTINCT SOURCE) FROM injury_accident
How many games are free of injury accidents?
CREATE TABLE injury_accident (id VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, game_id VARCHAR)
SELECT COUNT(*) FROM game WHERE NOT id IN (SELECT game_id FROM injury_accident)
### Context: CREATE TABLE injury_accident (id VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, game_id VARCHAR) ### Question: How many games are free of injury accidents? ### Answer: SELECT COUNT(*) FROM game WHERE NOT id IN (SELECT game_id FROM injury_accident)
How many distinct kinds of injuries happened after season 2010?
CREATE TABLE injury_accident (injury VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, season INTEGER)
SELECT COUNT(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010
### Context: CREATE TABLE injury_accident (injury VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, season INTEGER) ### Question: How many distinct kinds of injuries happened after season 2010? ### Answer: SELECT COUNT(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010
List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.
CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR)
SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'
### Context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR) ### Question: List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured. ### Answer: SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'
Show the name, average attendance, total attendance for stadiums where no accidents happened.
CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR, id VARCHAR); CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR)
SELECT name, average_attendance, total_attendance FROM stadium EXCEPT SELECT T2.name, T2.average_attendance, T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id
### Context: CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR, id VARCHAR); CREATE TABLE stadium (name VARCHAR, average_attendance VARCHAR, total_attendance VARCHAR); CREATE TABLE game (stadium_id VARCHAR, id VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR) ### Question: Show the name, average attendance, total attendance for stadiums where no accidents happened. ### Answer: SELECT name, average_attendance, total_attendance FROM stadium EXCEPT SELECT T2.name, T2.average_attendance, T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id
Which stadium name contains the substring "Bank"?
CREATE TABLE stadium (name VARCHAR)
SELECT name FROM stadium WHERE name LIKE "%Bank%"
### Context: CREATE TABLE stadium (name VARCHAR) ### Question: Which stadium name contains the substring "Bank"? ### Answer: SELECT name FROM stadium WHERE name LIKE "%Bank%"
How many games has each stadium held?
CREATE TABLE stadium (id VARCHAR); CREATE TABLE game (stadium_id VARCHAR)
SELECT T1.id, COUNT(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id
### Context: CREATE TABLE stadium (id VARCHAR); CREATE TABLE game (stadium_id VARCHAR) ### Question: How many games has each stadium held? ### Answer: SELECT T1.id, COUNT(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id
For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.
CREATE TABLE game (date VARCHAR, id VARCHAR, season VARCHAR); CREATE TABLE injury_accident (player VARCHAR, game_id VARCHAR)
SELECT T1.date, T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC
### Context: CREATE TABLE game (date VARCHAR, id VARCHAR, season VARCHAR); CREATE TABLE injury_accident (player VARCHAR, game_id VARCHAR) ### Question: For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season. ### Answer: SELECT T1.date, T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC
List all country and league names.
CREATE TABLE League (name VARCHAR, country_id VARCHAR); CREATE TABLE Country (name VARCHAR, id VARCHAR)
SELECT T1.name, T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id
### Context: CREATE TABLE League (name VARCHAR, country_id VARCHAR); CREATE TABLE Country (name VARCHAR, id VARCHAR) ### Question: List all country and league names. ### Answer: SELECT T1.name, T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id
How many leagues are there in England?
CREATE TABLE League (country_id VARCHAR); CREATE TABLE Country (id VARCHAR, name VARCHAR)
SELECT COUNT(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England"
### Context: CREATE TABLE League (country_id VARCHAR); CREATE TABLE Country (id VARCHAR, name VARCHAR) ### Question: How many leagues are there in England? ### Answer: SELECT COUNT(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England"
What is the average weight of all players?
CREATE TABLE Player (weight INTEGER)
SELECT AVG(weight) FROM Player
### Context: CREATE TABLE Player (weight INTEGER) ### Question: What is the average weight of all players? ### Answer: SELECT AVG(weight) FROM Player
What is the maximum and minimum height of all players?
CREATE TABLE Player (weight INTEGER)
SELECT MAX(weight), MIN(weight) FROM Player
### Context: CREATE TABLE Player (weight INTEGER) ### Question: What is the maximum and minimum height of all players? ### Answer: SELECT MAX(weight), MIN(weight) FROM Player
List all player names who have an overall rating higher than the average.
CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating INTEGER)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating > (SELECT AVG(overall_rating) FROM Player_Attributes)
### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating INTEGER) ### Question: List all player names who have an overall rating higher than the average. ### Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating > (SELECT AVG(overall_rating) FROM Player_Attributes)
What are the names of players who have the best dribbling?
CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, dribbling VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = (SELECT MAX(overall_rating) FROM Player_Attributes)
### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, dribbling VARCHAR); CREATE TABLE Player_Attributes (overall_rating INTEGER) ### Question: What are the names of players who have the best dribbling? ### Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = (SELECT MAX(overall_rating) FROM Player_Attributes)
List the names of all players who have a crossing score higher than 90 and prefer their right foot.
CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, crossing VARCHAR, preferred_foot VARCHAR)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing > 90 AND T2.preferred_foot = "right"
### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, crossing VARCHAR, preferred_foot VARCHAR) ### Question: List the names of all players who have a crossing score higher than 90 and prefer their right foot. ### Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing > 90 AND T2.preferred_foot = "right"
List the names of all left-footed players who have overall rating between 85 and 90.
CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating VARCHAR, preferred_foot VARCHAR)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = "left" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90
### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR, overall_rating VARCHAR, preferred_foot VARCHAR) ### Question: List the names of all left-footed players who have overall rating between 85 and 90. ### Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot = "left" AND T2.overall_rating >= 85 AND T2.overall_rating <= 90
What is the average rating for right-footed players and left-footed players?
CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER)
SELECT preferred_foot, AVG(overall_rating) FROM Player_Attributes GROUP BY preferred_foot
### Context: CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER) ### Question: What is the average rating for right-footed players and left-footed players? ### Answer: SELECT preferred_foot, AVG(overall_rating) FROM Player_Attributes GROUP BY preferred_foot
Of all players with an overall rating greater than 80, how many are right-footed and left-footed?
CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER)
SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot
### Context: CREATE TABLE Player_Attributes (preferred_foot VARCHAR, overall_rating INTEGER) ### Question: Of all players with an overall rating greater than 80, how many are right-footed and left-footed? ### Answer: SELECT preferred_foot, COUNT(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot
List all of the player ids with a height of at least 180cm and an overall rating higher than 85.
CREATE TABLE Player_Attributes (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER); CREATE TABLE Player (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER)
SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85
### Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER); CREATE TABLE Player (player_api_id VARCHAR, height VARCHAR, overall_rating INTEGER) ### Question: List all of the player ids with a height of at least 180cm and an overall rating higher than 85. ### Answer: SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85
List all of the ids for left-footed players with a height between 180cm and 190cm.
CREATE TABLE Player_Attributes (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR); CREATE TABLE Player (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR)
SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = "left"
### Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR); CREATE TABLE Player (player_api_id VARCHAR, preferred_foot VARCHAR, height VARCHAR) ### Question: List all of the ids for left-footed players with a height between 180cm and 190cm. ### Answer: SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = "left"
Who are the top 3 players in terms of overall rating?
CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR)
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3
### Context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (player_api_id VARCHAR) ### Question: Who are the top 3 players in terms of overall rating? ### Answer: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3
List the names and birthdays of the top five players in terms of potential.
CREATE TABLE Player_Attributes (player_api_id VARCHAR); CREATE TABLE Player (player_name VARCHAR, birthday VARCHAR, player_api_id VARCHAR)
SELECT DISTINCT T1.player_name, T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5
### Context: CREATE TABLE Player_Attributes (player_api_id VARCHAR); CREATE TABLE Player (player_name VARCHAR, birthday VARCHAR, player_api_id VARCHAR) ### Question: List the names and birthdays of the top five players in terms of potential. ### Answer: SELECT DISTINCT T1.player_name, T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY potential DESC LIMIT 5
How many performances are there?
CREATE TABLE performance (Id VARCHAR)
SELECT COUNT(*) FROM performance
### Context: CREATE TABLE performance (Id VARCHAR) ### Question: How many performances are there? ### Answer: SELECT COUNT(*) FROM performance
List the hosts of performances in ascending order of attendance.
CREATE TABLE performance (HOST VARCHAR, Attendance VARCHAR)
SELECT HOST FROM performance ORDER BY Attendance
### Context: CREATE TABLE performance (HOST VARCHAR, Attendance VARCHAR) ### Question: List the hosts of performances in ascending order of attendance. ### Answer: SELECT HOST FROM performance ORDER BY Attendance
What are the dates and locations of performances?
CREATE TABLE performance (Date VARCHAR, LOCATION VARCHAR)
SELECT Date, LOCATION FROM performance
### Context: CREATE TABLE performance (Date VARCHAR, LOCATION VARCHAR) ### Question: What are the dates and locations of performances? ### Answer: SELECT Date, LOCATION FROM performance
Show the attendances of the performances at location "TD Garden" or "Bell Centre"
CREATE TABLE performance (Attendance VARCHAR, LOCATION VARCHAR)
SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre"
### Context: CREATE TABLE performance (Attendance VARCHAR, LOCATION VARCHAR) ### Question: Show the attendances of the performances at location "TD Garden" or "Bell Centre" ### Answer: SELECT Attendance FROM performance WHERE LOCATION = "TD Garden" OR LOCATION = "Bell Centre"
What is the average number of attendees for performances?
CREATE TABLE performance (Attendance INTEGER)
SELECT AVG(Attendance) FROM performance
### Context: CREATE TABLE performance (Attendance INTEGER) ### Question: What is the average number of attendees for performances? ### Answer: SELECT AVG(Attendance) FROM performance
What is the date of the performance with the highest number of attendees?
CREATE TABLE performance (Date VARCHAR, Attendance VARCHAR)
SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1
### Context: CREATE TABLE performance (Date VARCHAR, Attendance VARCHAR) ### Question: What is the date of the performance with the highest number of attendees? ### Answer: SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1
Show different locations and the number of performances at each location.
CREATE TABLE performance (LOCATION VARCHAR)
SELECT LOCATION, COUNT(*) FROM performance GROUP BY LOCATION
### Context: CREATE TABLE performance (LOCATION VARCHAR) ### Question: Show different locations and the number of performances at each location. ### Answer: SELECT LOCATION, COUNT(*) FROM performance GROUP BY LOCATION
Show the most common location of performances.
CREATE TABLE performance (LOCATION VARCHAR)
SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
### Context: CREATE TABLE performance (LOCATION VARCHAR) ### Question: Show the most common location of performances. ### Answer: SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
Show the locations that have at least two performances.
CREATE TABLE performance (LOCATION VARCHAR)
SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2
### Context: CREATE TABLE performance (LOCATION VARCHAR) ### Question: Show the locations that have at least two performances. ### Answer: SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*) >= 2
Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees.
CREATE TABLE performance (LOCATION VARCHAR, Attendance INTEGER)
SELECT LOCATION FROM performance WHERE Attendance > 2000 INTERSECT SELECT LOCATION FROM performance WHERE Attendance < 1000
### Context: CREATE TABLE performance (LOCATION VARCHAR, Attendance INTEGER) ### Question: Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees. ### Answer: SELECT LOCATION FROM performance WHERE Attendance > 2000 INTERSECT SELECT LOCATION FROM performance WHERE Attendance < 1000
Show the names of members and the location of the performances they attended.
CREATE TABLE performance (Location VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR)
SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID
### Context: CREATE TABLE performance (Location VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ### Question: Show the names of members and the location of the performances they attended. ### Answer: SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID
Show the names of members and the location of performances they attended in ascending alphabetical order of their names.
CREATE TABLE performance (Location VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR)
SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T2.Name
### Context: CREATE TABLE performance (Location VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ### Question: Show the names of members and the location of performances they attended in ascending alphabetical order of their names. ### Answer: SELECT T2.Name, T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T2.Name
Show the dates of performances with attending members whose roles are "Violin".
CREATE TABLE performance (Date VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Member_ID VARCHAR, Role VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR)
SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin"
### Context: CREATE TABLE performance (Date VARCHAR, Performance_ID VARCHAR); CREATE TABLE member (Member_ID VARCHAR, Role VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ### Question: Show the dates of performances with attending members whose roles are "Violin". ### Answer: SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID WHERE T2.Role = "Violin"
Show the names of members and the dates of performances they attended in descending order of attendance of the performances.
CREATE TABLE performance (Date VARCHAR, Performance_ID VARCHAR, Attendance VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR)
SELECT T2.Name, T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T3.Attendance DESC
### Context: CREATE TABLE performance (Date VARCHAR, Performance_ID VARCHAR, Attendance VARCHAR); CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Member_ID VARCHAR, Performance_ID VARCHAR) ### Question: Show the names of members and the dates of performances they attended in descending order of attendance of the performances. ### Answer: SELECT T2.Name, T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID = T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID = T3.Performance_ID ORDER BY T3.Attendance DESC
List the names of members who did not attend any performance.
CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Name VARCHAR, Member_ID VARCHAR)
SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM member_attendance)
### Context: CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Name VARCHAR, Member_ID VARCHAR) ### Question: List the names of members who did not attend any performance. ### Answer: SELECT Name FROM member WHERE NOT Member_ID IN (SELECT Member_ID FROM member_attendance)
Find the buildings which have rooms with capacity more than 50.
CREATE TABLE classroom (building VARCHAR, capacity INTEGER)
SELECT DISTINCT building FROM classroom WHERE capacity > 50
### Context: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) ### Question: Find the buildings which have rooms with capacity more than 50. ### Answer: SELECT DISTINCT building FROM classroom WHERE capacity > 50
Count the number of rooms that are not in the Lamberton building.
CREATE TABLE classroom (building VARCHAR)
SELECT COUNT(*) FROM classroom WHERE building <> 'Lamberton'
### Context: CREATE TABLE classroom (building VARCHAR) ### Question: Count the number of rooms that are not in the Lamberton building. ### Answer: SELECT COUNT(*) FROM classroom WHERE building <> 'Lamberton'
What is the name and building of the departments whose budget is more than the average budget?
CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget INTEGER)
SELECT dept_name, building FROM department WHERE budget > (SELECT AVG(budget) FROM department)
### Context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget INTEGER) ### Question: What is the name and building of the departments whose budget is more than the average budget? ### Answer: SELECT dept_name, building FROM department WHERE budget > (SELECT AVG(budget) FROM department)
Find the room number of the rooms which can sit 50 to 100 students and their buildings.
CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity INTEGER)
SELECT building, room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
### Context: CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity INTEGER) ### Question: Find the room number of the rooms which can sit 50 to 100 students and their buildings. ### Answer: SELECT building, room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
Find the name and building of the department with the highest budget.
CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR)
SELECT dept_name, building FROM department ORDER BY budget DESC LIMIT 1
### Context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR) ### Question: Find the name and building of the department with the highest budget. ### Answer: SELECT dept_name, building FROM department ORDER BY budget DESC LIMIT 1
What is the name of the student who has the highest total credits in the History department.
CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR)
SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1
### Context: CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR) ### Question: What is the name of the student who has the highest total credits in the History department. ### Answer: SELECT name FROM student WHERE dept_name = 'History' ORDER BY tot_cred DESC LIMIT 1
How many rooms does the Lamberton building have?
CREATE TABLE classroom (building VARCHAR)
SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton'
### Context: CREATE TABLE classroom (building VARCHAR) ### Question: How many rooms does the Lamberton building have? ### Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton'
How many students have advisors?
CREATE TABLE advisor (s_id VARCHAR)
SELECT COUNT(DISTINCT s_id) FROM advisor
### Context: CREATE TABLE advisor (s_id VARCHAR) ### Question: How many students have advisors? ### Answer: SELECT COUNT(DISTINCT s_id) FROM advisor
How many departments offer courses?
CREATE TABLE course (dept_name VARCHAR)
SELECT COUNT(DISTINCT dept_name) FROM course
### Context: CREATE TABLE course (dept_name VARCHAR) ### Question: How many departments offer courses? ### Answer: SELECT COUNT(DISTINCT dept_name) FROM course
How many different courses offered by Physics department?
CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR)
SELECT COUNT(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'
### Context: CREATE TABLE course (course_id VARCHAR, dept_name VARCHAR) ### Question: How many different courses offered by Physics department? ### Answer: SELECT COUNT(DISTINCT course_id) FROM course WHERE dept_name = 'Physics'
Find the title of courses that have two prerequisites?
CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR)
SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) = 2
### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR) ### Question: Find the title of courses that have two prerequisites? ### Answer: SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) = 2
Find the title, credit, and department name of courses that have more than one prerequisites?
CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, dept_name VARCHAR, course_id VARCHAR)
SELECT T1.title, T1.credits, T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) > 1
### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, dept_name VARCHAR, course_id VARCHAR) ### Question: Find the title, credit, and department name of courses that have more than one prerequisites? ### Answer: SELECT T1.title, T1.credits, T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY T2.course_id HAVING COUNT(*) > 1
How many courses that do not have prerequisite?
CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (course_id VARCHAR)
SELECT COUNT(*) FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)
### Context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (course_id VARCHAR) ### Question: How many courses that do not have prerequisite? ### Answer: SELECT COUNT(*) FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)
Find the name of the courses that do not have any prerequisite?
CREATE TABLE prereq (title VARCHAR, course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR)
SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)
### Context: CREATE TABLE prereq (title VARCHAR, course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR) ### Question: Find the name of the courses that do not have any prerequisite? ### Answer: SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)
How many different instructors have taught some course?
CREATE TABLE teaches (id VARCHAR)
SELECT COUNT(DISTINCT id) FROM teaches
### Context: CREATE TABLE teaches (id VARCHAR) ### Question: How many different instructors have taught some course? ### Answer: SELECT COUNT(DISTINCT id) FROM teaches
Find the total budgets of the Marketing or Finance department.
CREATE TABLE department (budget INTEGER, dept_name VARCHAR)
SELECT SUM(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'
### Context: CREATE TABLE department (budget INTEGER, dept_name VARCHAR) ### Question: Find the total budgets of the Marketing or Finance department. ### Answer: SELECT SUM(budget) FROM department WHERE dept_name = 'Marketing' OR dept_name = 'Finance'
Find the department name of the instructor whose name contains 'Soisalon'.
CREATE TABLE instructor (dept_name VARCHAR, name VARCHAR)
SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
### Context: CREATE TABLE instructor (dept_name VARCHAR, name VARCHAR) ### Question: Find the department name of the instructor whose name contains 'Soisalon'. ### Answer: SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'
How many rooms whose capacity is less than 50 does the Lamberton building have?
CREATE TABLE classroom (building VARCHAR, capacity VARCHAR)
SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50
### Context: CREATE TABLE classroom (building VARCHAR, capacity VARCHAR) ### Question: How many rooms whose capacity is less than 50 does the Lamberton building have? ### Answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50
Find the name and budget of departments whose budgets are more than the average budget.
CREATE TABLE department (dept_name VARCHAR, budget INTEGER)
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department)
### Context: CREATE TABLE department (dept_name VARCHAR, budget INTEGER) ### Question: Find the name and budget of departments whose budgets are more than the average budget. ### Answer: SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department)
what is the name of the instructor who is in Statistics department and earns the lowest salary?
CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary VARCHAR)
SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1
### Context: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary VARCHAR) ### Question: what is the name of the instructor who is in Statistics department and earns the lowest salary? ### Answer: SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1
Find the title of course that is provided by both Statistics and Psychology departments.
CREATE TABLE course (title VARCHAR, dept_name VARCHAR)
SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'
### Context: CREATE TABLE course (title VARCHAR, dept_name VARCHAR) ### Question: Find the title of course that is provided by both Statistics and Psychology departments. ### Answer: SELECT title FROM course WHERE dept_name = 'Statistics' INTERSECT SELECT title FROM course WHERE dept_name = 'Psychology'
Find the title of course that is provided by Statistics but not Psychology departments.
CREATE TABLE course (title VARCHAR, dept_name VARCHAR)
SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'
### Context: CREATE TABLE course (title VARCHAR, dept_name VARCHAR) ### Question: Find the title of course that is provided by Statistics but not Psychology departments. ### Answer: SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'
Find the id of instructors who taught a class in Fall 2009 but not in Spring 2010.
CREATE TABLE teaches (id VARCHAR, semester VARCHAR, YEAR VARCHAR)
SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010
### Context: CREATE TABLE teaches (id VARCHAR, semester VARCHAR, YEAR VARCHAR) ### Question: Find the id of instructors who taught a class in Fall 2009 but not in Spring 2010. ### Answer: SELECT id FROM teaches WHERE semester = 'Fall' AND YEAR = 2009 EXCEPT SELECT id FROM teaches WHERE semester = 'Spring' AND YEAR = 2010
Find the name of students who took any class in the years of 2009 and 2010.
CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (id VARCHAR)
SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010
### Context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (id VARCHAR) ### Question: Find the name of students who took any class in the years of 2009 and 2010. ### Answer: SELECT DISTINCT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id = T2.id WHERE YEAR = 2009 OR YEAR = 2010
Find the names of the top 3 departments that provide the largest amount of courses?
CREATE TABLE course (dept_name VARCHAR)
SELECT dept_name FROM course GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 3
### Context: CREATE TABLE course (dept_name VARCHAR) ### Question: Find the names of the top 3 departments that provide the largest amount of courses? ### Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY COUNT(*) DESC LIMIT 3
Find the name of the department that offers the highest total credits?
CREATE TABLE course (dept_name VARCHAR, credits INTEGER)
SELECT dept_name FROM course GROUP BY dept_name ORDER BY SUM(credits) DESC LIMIT 1
### Context: CREATE TABLE course (dept_name VARCHAR, credits INTEGER) ### Question: Find the name of the department that offers the highest total credits? ### Answer: SELECT dept_name FROM course GROUP BY dept_name ORDER BY SUM(credits) DESC LIMIT 1
List the names of all courses ordered by their titles and credits.
CREATE TABLE course (title VARCHAR, credits VARCHAR)
SELECT title FROM course ORDER BY title, credits
### Context: CREATE TABLE course (title VARCHAR, credits VARCHAR) ### Question: List the names of all courses ordered by their titles and credits. ### Answer: SELECT title FROM course ORDER BY title, credits
Which department has the lowest budget?
CREATE TABLE department (dept_name VARCHAR, budget VARCHAR)
SELECT dept_name FROM department ORDER BY budget LIMIT 1
### Context: CREATE TABLE department (dept_name VARCHAR, budget VARCHAR) ### Question: Which department has the lowest budget? ### Answer: SELECT dept_name FROM department ORDER BY budget LIMIT 1
List the names and buildings of all departments sorted by the budget from large to small.
CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR)
SELECT dept_name, building FROM department ORDER BY budget DESC
### Context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR) ### Question: List the names and buildings of all departments sorted by the budget from large to small. ### Answer: SELECT dept_name, building FROM department ORDER BY budget DESC
Who is the instructor with the highest salary?
CREATE TABLE instructor (name VARCHAR, salary VARCHAR)
SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
### Context: CREATE TABLE instructor (name VARCHAR, salary VARCHAR) ### Question: Who is the instructor with the highest salary? ### Answer: SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
List the information of all instructors ordered by their salary in ascending order.
CREATE TABLE instructor (salary VARCHAR)
SELECT * FROM instructor ORDER BY salary
### Context: CREATE TABLE instructor (salary VARCHAR) ### Question: List the information of all instructors ordered by their salary in ascending order. ### Answer: SELECT * FROM instructor ORDER BY salary
Find the name of the students and their department names sorted by their total credits in ascending order.
CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR)
SELECT name, dept_name FROM student ORDER BY tot_cred
### Context: CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR) ### Question: Find the name of the students and their department names sorted by their total credits in ascending order. ### Answer: SELECT name, dept_name FROM student ORDER BY tot_cred
list in alphabetic order all course names and their instructors' names in year 2008.
CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE teaches (course_id VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR)
SELECT T1.title, T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 ORDER BY T1.title
### Context: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE teaches (course_id VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) ### Question: list in alphabetic order all course names and their instructors' names in year 2008. ### Answer: SELECT T1.title, T3.name FROM course AS T1 JOIN teaches AS T2 ON T1.course_id = T2.course_id JOIN instructor AS T3 ON T2.id = T3.id WHERE YEAR = 2008 ORDER BY T1.title