text
stringlengths 114
1.06k
|
---|
### 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" ### context: CREATE TABLE Apartment_Bookings (booking_start_date VARCHAR, guest_id VARCHAR); CREATE TABLE Guests (guest_id VARCHAR, gender_code 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" ### 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 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 ### context: CREATE TABLE Apartment_Facilities (facility_code VARCHAR, apt_id VARCHAR); CREATE TABLE Apartments (apt_id VARCHAR, bedroom_count INTEGER) |
### 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" ### 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 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" ### context: CREATE TABLE Apartment_Buildings (building_id VARCHAR, building_short_name VARCHAR); CREATE TABLE Apartments (room_count INTEGER, building_id VARCHAR) |
### 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 ### context: CREATE TABLE Apartment_Buildings (building_address VARCHAR, building_id VARCHAR); CREATE TABLE Apartments (building_id VARCHAR, bathroom_count INTEGER) |
### 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" ### 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 booking status code and the corresponding number of bookings. ### answer: SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code ### context: CREATE TABLE Apartment_Bookings (booking_status_code 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 ### context: CREATE TABLE Apartments (apt_number VARCHAR, room_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 ### context: CREATE TABLE Apartments (apt_number VARCHAR, bedroom_count 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(*) ### context: CREATE TABLE Apartments (apt_type_code VARCHAR) |
### 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 ### context: CREATE TABLE Apartments (apt_type_code 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 ### context: CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_count VARCHAR, bedroom_count VARCHAR, room_count INTEGER) |
### 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 ### context: CREATE TABLE Apartments (apt_type_code VARCHAR) |
### 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 ### context: CREATE TABLE Apartments (apt_type_code VARCHAR, bathroom_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 ### context: CREATE TABLE Apartments (apt_type_code VARCHAR, room_count INTEGER) |
### 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 ### context: CREATE TABLE Guests (gender_code 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) ### context: CREATE TABLE Apartment_Facilities (apt_id VARCHAR); CREATE TABLE Apartments (apt_id 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" ### 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 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 ### context: CREATE TABLE View_Unit_Status (apt_id VARCHAR, available_yn VARCHAR); CREATE TABLE Apartments (apt_number VARCHAR, apt_id VARCHAR) |
### question: How many games are held after season 2007? ### answer: SELECT COUNT(*) FROM game WHERE season > 2007 ### context: CREATE TABLE game (season INTEGER) |
### question: List the dates of games by the home team name in descending order. ### answer: SELECT Date FROM game ORDER BY home_team DESC ### context: CREATE TABLE game (Date VARCHAR, home_team VARCHAR) |
### question: List the season, home team, away team of all the games. ### answer: SELECT season, home_team, away_team FROM game ### context: CREATE TABLE game (season VARCHAR, home_team VARCHAR, away_team VARCHAR) |
### 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 ### context: CREATE TABLE stadium (home_games 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 ### context: CREATE TABLE stadium (average_attendance VARCHAR, capacity_percentage INTEGER) |
### 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' ### context: CREATE TABLE injury_accident (player VARCHAR, number_of_matches VARCHAR, SOURCE VARCHAR, injury 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' ### context: CREATE TABLE injury_accident (game_id VARCHAR, player VARCHAR); CREATE TABLE game (season VARCHAR, 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 ### context: CREATE TABLE game (id VARCHAR, score VARCHAR, date VARCHAR); CREATE TABLE injury_accident (game_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 ### context: CREATE TABLE stadium (id VARCHAR, name VARCHAR); CREATE TABLE injury_accident (game_id VARCHAR); CREATE TABLE game (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' ### 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: How many different kinds of information sources are there for injury accidents? ### answer: SELECT COUNT(DISTINCT SOURCE) FROM injury_accident ### context: CREATE TABLE injury_accident (SOURCE 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) ### context: CREATE TABLE injury_accident (id VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, game_id VARCHAR) |
### 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 ### context: CREATE TABLE injury_accident (injury VARCHAR, game_id VARCHAR); CREATE TABLE game (id VARCHAR, season INTEGER) |
### 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' ### 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: 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 ### 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: Which stadium name contains the substring "Bank"? ### answer: SELECT name FROM stadium WHERE name LIKE "%Bank%" ### context: CREATE TABLE stadium (name 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 ### context: CREATE TABLE stadium (id VARCHAR); CREATE TABLE game (stadium_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 ### context: CREATE TABLE game (date VARCHAR, id VARCHAR, season VARCHAR); CREATE TABLE injury_accident (player VARCHAR, game_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 ### context: CREATE TABLE League (name VARCHAR, country_id VARCHAR); CREATE TABLE Country (name VARCHAR, id 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" ### context: CREATE TABLE League (country_id VARCHAR); CREATE TABLE Country (id VARCHAR, name VARCHAR) |
### question: What is the average weight of all players? ### answer: SELECT AVG(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 ### context: CREATE TABLE Player (weight 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) ### 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: 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) ### 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: 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" ### 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 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 ### 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: 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 ### 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 ### context: CREATE TABLE Player_Attributes (preferred_foot 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 ### 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 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" ### 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: 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 ### context: CREATE TABLE Player (player_name VARCHAR, player_api_id VARCHAR); CREATE TABLE Player_Attributes (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 ### context: CREATE TABLE Player_Attributes (player_api_id VARCHAR); CREATE TABLE Player (player_name VARCHAR, birthday VARCHAR, player_api_id VARCHAR) |
### question: How many performances are there? ### answer: SELECT COUNT(*) FROM performance ### context: CREATE TABLE performance (Id VARCHAR) |
### question: List the hosts of performances in ascending order of attendance. ### answer: SELECT HOST FROM performance ORDER BY Attendance ### context: CREATE TABLE performance (HOST VARCHAR, Attendance VARCHAR) |
### question: What are the dates and locations of performances? ### answer: SELECT Date, LOCATION FROM performance ### context: CREATE TABLE performance (Date 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" ### context: CREATE TABLE performance (Attendance VARCHAR, LOCATION VARCHAR) |
### question: What is the average number of attendees for performances? ### answer: SELECT AVG(Attendance) FROM performance ### context: CREATE TABLE performance (Attendance INTEGER) |
### 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 ### context: CREATE TABLE performance (Date VARCHAR, Attendance VARCHAR) |
### question: Show different locations and the number of performances at each location. ### answer: SELECT LOCATION, COUNT(*) FROM performance GROUP BY LOCATION ### 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 ### 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 ### context: CREATE TABLE performance (LOCATION VARCHAR) |
### 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 ### context: CREATE TABLE performance (LOCATION VARCHAR, Attendance INTEGER) |
### 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 ### 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 ### 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 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" ### 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 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 ### 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: 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) ### context: CREATE TABLE member (Name VARCHAR, Member_ID VARCHAR); CREATE TABLE member_attendance (Name VARCHAR, Member_ID VARCHAR) |
### question: Find the buildings which have rooms with capacity more than 50. ### answer: SELECT DISTINCT building FROM classroom WHERE capacity > 50 ### context: CREATE TABLE classroom (building VARCHAR, capacity INTEGER) |
### question: Count the number of rooms that are not in the Lamberton building. ### answer: SELECT COUNT(*) FROM classroom WHERE building <> 'Lamberton' ### context: CREATE TABLE classroom (building VARCHAR) |
### 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) ### context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget 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 ### context: CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity INTEGER) |
### 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 ### context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget 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 ### context: CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred VARCHAR) |
### question: How many rooms does the Lamberton building have? ### answer: SELECT COUNT(*) FROM classroom WHERE building = 'Lamberton' ### context: CREATE TABLE classroom (building VARCHAR) |
### question: How many students have advisors? ### answer: SELECT COUNT(DISTINCT s_id) FROM advisor ### context: CREATE TABLE advisor (s_id VARCHAR) |
### question: How many departments offer courses? ### answer: SELECT COUNT(DISTINCT dept_name) FROM course ### context: CREATE TABLE course (dept_name VARCHAR) |
### question: How many different courses offered by Physics department? ### answer: SELECT COUNT(DISTINCT course_id) FROM course WHERE dept_name = 'Physics' ### context: CREATE TABLE course (course_id VARCHAR, dept_name 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 ### context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title 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 ### context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (title VARCHAR, credits VARCHAR, dept_name VARCHAR, 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) ### context: CREATE TABLE prereq (course_id VARCHAR); CREATE TABLE course (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) ### context: CREATE TABLE prereq (title VARCHAR, course_id VARCHAR); CREATE TABLE course (title VARCHAR, course_id VARCHAR) |
### question: How many different instructors have taught some course? ### answer: SELECT COUNT(DISTINCT id) FROM teaches ### context: CREATE TABLE teaches (id 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' ### context: CREATE TABLE department (budget INTEGER, dept_name VARCHAR) |
### question: Find the department name of the instructor whose name contains 'Soisalon'. ### answer: SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%' ### context: CREATE TABLE instructor (dept_name VARCHAR, name 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 ### context: CREATE TABLE classroom (building VARCHAR, capacity VARCHAR) |
### 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) ### context: CREATE TABLE department (dept_name VARCHAR, budget INTEGER) |
### 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 ### context: CREATE TABLE instructor (name VARCHAR, dept_name VARCHAR, salary 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' ### 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' ### context: CREATE TABLE course (title VARCHAR, dept_name 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 ### context: CREATE TABLE teaches (id VARCHAR, semester VARCHAR, YEAR 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 ### context: CREATE TABLE student (name VARCHAR, id VARCHAR); CREATE TABLE takes (id 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 ### context: CREATE TABLE course (dept_name VARCHAR) |
### 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 ### context: CREATE TABLE course (dept_name VARCHAR, credits INTEGER) |
### question: List the names of all courses ordered by their titles and credits. ### answer: SELECT title FROM course ORDER BY title, credits ### context: CREATE TABLE course (title VARCHAR, credits VARCHAR) |
### question: Which department has the lowest budget? ### answer: SELECT dept_name FROM department ORDER BY budget LIMIT 1 ### context: CREATE TABLE department (dept_name 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 ### context: CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget VARCHAR) |
### question: Who is the instructor with the highest salary? ### answer: SELECT name FROM instructor ORDER BY salary DESC LIMIT 1 ### context: CREATE TABLE instructor (name VARCHAR, salary VARCHAR) |
### question: List the information of all instructors ordered by their salary in ascending order. ### answer: SELECT * FROM instructor ORDER BY salary ### context: CREATE TABLE instructor (salary 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 ### context: CREATE TABLE student (name VARCHAR, dept_name VARCHAR, tot_cred 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 ### context: CREATE TABLE course (title VARCHAR, course_id VARCHAR); CREATE TABLE teaches (course_id VARCHAR, id VARCHAR); CREATE TABLE instructor (name VARCHAR, id VARCHAR) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.