target-benchmark/spider-queries huggingface dataset:
Database: body_builder (tables: people, body_builder)
Question: What is the name of the body builder with the greatest body weight?
SQL: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID ORDER BY T2.Weight DESC LIMIT 1
Database: body_builder (tables: people, body_builder)
Question: What are the birth date and birth place of the body builder with the highest total points?
SQL: SELECT T2.Birth_Date ,  T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID ORDER BY T1.Total DESC LIMIT 1
Database: body_builder (tables: people, body_builder)
Question: What are the heights of body builders with total score smaller than 315?
SQL: SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID WHERE T1.Total  <  315
Database: body_builder (tables: people, body_builder)
Question: What is the average total score of body builders with height bigger than 200?
SQL: SELECT avg(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID WHERE T2.Height  >  200
Database: body_builder (tables: people, body_builder)
Question: What are the names of body builders in descending order of total scores?
SQL: SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID  =  T2.People_ID ORDER BY T1.Total DESC
Database: body_builder (tables: people)
Question: List each birth place along with the number of people from there.
SQL: SELECT Birth_Place ,  COUNT(*) FROM people GROUP BY Birth_Place
Database: body_builder (tables: people)
Question: What is the most common birth place of people?
SQL: SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1
Database: body_builder (tables: people)
Question: What are the birth places that are shared by at least two people?
SQL: SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*)  >=  2
Database: body_builder (tables: people)
Question: List the height and weight of people in descending order of height.
SQL: SELECT Height ,  Weight FROM people ORDER BY Height DESC
Database: body_builder (tables: body_builder)
Question: Show all information about each body builder.
SQL: SELECT * FROM body_builder
Database: body_builder (tables: body_builder, people)
Question: List the names and origins of people who are not body builders.
SQL: SELECT Name ,  birth_place FROM people EXCEPT SELECT T1.Name ,  T1.birth_place FROM people AS T1 JOIN body_builder AS T2 ON T1.people_id  =  T2.people_id
Database: body_builder (tables: people)
Question: How many distinct birth places are there?
SQL: SELECT count(DISTINCT Birth_Place) FROM people
Database: body_builder (tables: people, body_builder)
Question: How many persons are not body builders?
SQL: SELECT count(*) FROM people WHERE people_id NOT IN (SELECT People_ID FROM body_builder)
Database: body_builder (tables: people, body_builder)
Question: List the weight of the body builders who have snatch score higher than 140 or have the height greater than 200.
SQL: SELECT T2.weight FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id  =  T2.people_id WHERE T1.snatch  >  140 OR T2.height  >  200;
Database: body_builder (tables: people, body_builder)
Question: What are the total scores of the body builders whose birthday contains the string "January" ?
SQL: SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id  =  T2.people_id WHERE T2.Birth_Date LIKE "%January%";
Database: body_builder (tables: body_builder)
Question: What is the minimum snatch score?
SQL: SELECT min(snatch) FROM body_builder
Database: election_representative (tables: election)
Question: How many elections are there?
SQL: SELECT count(*) FROM election
Database: election_representative (tables: election)
Question: List the votes of elections in descending order.
SQL: SELECT Votes FROM election ORDER BY Votes DESC
Database: election_representative (tables: election)
Question: List the dates and vote percents of elections.
SQL: SELECT Date ,  Vote_Percent FROM election
Database: election_representative (tables: election)
Question: What are the minimum and maximum vote percents of elections?
SQL: SELECT min(Vote_Percent) ,  max(Vote_Percent) FROM election
Database: election_representative (tables: representative)
Question: What are the names and parties of representatives?
SQL: SELECT Name ,  Party FROM representative
Database: election_representative (tables: representative)
Question: What are the names of representatives whose party is not "Republican"?
SQL: SELECT Name FROM Representative WHERE Party != "Republican"
Database: election_representative (tables: representative)
Question: What are the life spans of representatives from New York state or Indiana state?
SQL: SELECT Lifespan FROM representative WHERE State  =  "New York" OR State  =  "Indiana"
Database: election_representative (tables: election, representative)
Question: What are the names of representatives and the dates of elections they participated in.
SQL: SELECT T2.Name ,  T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID  =  T2.Representative_ID
Database: election_representative (tables: election, representative)
Question: What are the names of representatives with more than 10000 votes in election?
SQL: SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID  =  T2.Representative_ID WHERE Votes  >  10000
Database: election_representative (tables: election, representative)
Question: What are the names of representatives in descending order of votes?
SQL: SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID  =  T2.Representative_ID ORDER BY votes DESC
Database: election_representative (tables: election, representative)
Question: What is the party of the representative that has the smallest number of votes.
SQL: SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID  =  T2.Representative_ID ORDER BY votes ASC LIMIT 1
Database: election_representative (tables: election, representative)
Question: What are the lifespans of representatives in descending order of vote percent?
SQL: SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID  =  T2.Representative_ID ORDER BY Vote_Percent DESC
Database: election_representative (tables: election, representative)
Question: What is the average number of votes of representatives from party "Republican"?
SQL: SELECT avg(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID  =  T2.Representative_ID WHERE T2.Party  =  "Republican"
Database: election_representative (tables: representative)
Question: What are the different parties of representative? Show the party name and the number of representatives in each party.
SQL: SELECT Party ,  COUNT(*) FROM representative GROUP BY Party
Database: election_representative (tables: representative)
Question: What is the party that has the largest number of representatives?
SQL: SELECT Party ,  COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1
Database: election_representative (tables: representative)
Question: What parties have at least three representatives?
SQL: SELECT Party FROM representative GROUP BY Party HAVING COUNT(*)  >=  3
Database: election_representative (tables: representative)
Question: What states have at least two representatives?
SQL: SELECT State FROM representative GROUP BY State HAVING COUNT(*)  >=  2
Database: election_representative (tables: election, representative)
Question: List the names of representatives that have not participated in elections listed here.
SQL: SELECT Name FROM representative WHERE Representative_ID NOT IN (SELECT Representative_ID FROM election)
Database: election_representative (tables: representative)
Question: Show the parties that have both representatives in New York state and representatives in Pennsylvania state.
SQL: SELECT Party FROM representative WHERE State  =  "New York" INTERSECT SELECT Party FROM representative WHERE State  =  "Pennsylvania"
Database: election_representative (tables: representative)
Question: How many distinct parties are there for representatives?
SQL: SELECT count(DISTINCT Party) FROM representative
Database: apartment_rentals (tables: apartment_bookings)
Question: How many apartment bookings are there in total?
SQL: SELECT count(*) FROM Apartment_Bookings
Database: apartment_rentals (tables: apartment_bookings)
Question: Count the total number of apartment bookings.
SQL: SELECT count(*) FROM Apartment_Bookings
Database: apartment_rentals (tables: apartment_bookings)
Question: Show the start dates and end dates of all the apartment bookings.
SQL: SELECT booking_start_date ,  booking_end_date FROM Apartment_Bookings
Database: apartment_rentals (tables: apartment_bookings)
Question: What are the start date and end date of each apartment booking?
SQL: SELECT booking_start_date ,  booking_end_date FROM Apartment_Bookings
Database: apartment_rentals (tables: apartment_buildings)
Question: Show all distinct building descriptions.
SQL: SELECT DISTINCT building_description FROM Apartment_Buildings
Database: apartment_rentals (tables: apartment_buildings)
Question: Give me a list of all the distinct building descriptions.
SQL: SELECT DISTINCT building_description FROM Apartment_Buildings
Database: apartment_rentals (tables: apartment_buildings)
Question: Show the short names of the buildings managed by "Emma".
SQL: SELECT building_short_name FROM Apartment_Buildings WHERE building_manager	 =  "Emma"
Database: apartment_rentals (tables: apartment_buildings)
Question: Which buildings does "Emma" manage? Give me the short names of the buildings.
SQL: SELECT building_short_name FROM Apartment_Buildings WHERE building_manager	 =  "Emma"
Database: apartment_rentals (tables: apartment_buildings)
Question: Show the addresses and phones of all the buildings managed by "Brenden".
SQL: SELECT building_address ,  building_phone FROM Apartment_Buildings WHERE building_manager	 =  "Brenden"
Database: apartment_rentals (tables: apartment_buildings)
Question: What are the address and phone number of the buildings managed by "Brenden"?
SQL: SELECT building_address ,  building_phone FROM Apartment_Buildings WHERE building_manager	 =  "Brenden"
Database: apartment_rentals (tables: apartment_buildings)
Question: What are the building full names that contain the word "court"?
SQL: SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"
Database: apartment_rentals (tables: apartment_buildings)
Question: Find all the building full names containing the word "court".
SQL: SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"
Database: apartment_rentals (tables: apartments)
Question: What is the minimum and maximum number of bathrooms of all the apartments?
SQL: SELECT min(bathroom_count) ,  max(bathroom_count) FROM Apartments
Database: apartment_rentals (tables: apartments)
Question: Give me the minimum and maximum bathroom count among all the apartments.
SQL: SELECT min(bathroom_count) ,  max(bathroom_count) FROM Apartments
Database: apartment_rentals (tables: apartments)
Question: What is the average number of bedrooms of all apartments?
SQL: SELECT avg(bedroom_count) FROM Apartments
Database: apartment_rentals (tables: apartments)
Question: Find the average number of bedrooms of all the apartments.
SQL: SELECT avg(bedroom_count) FROM Apartments
Database: apartment_rentals (tables: apartments)
Question: Return the apartment number and the number of rooms for each apartment.
SQL: SELECT apt_number ,  room_count FROM Apartments
Database: apartment_rentals (tables: apartments)
Question: What are the apartment number and the room count of each apartment?
SQL: SELECT apt_number ,  room_count FROM Apartments
Database: apartment_rentals (tables: apartments)
Question: What is the average number of rooms of apartments with type code "Studio"?
SQL: SELECT avg(room_count) FROM Apartments WHERE apt_type_code  =  "Studio"
Database: apartment_rentals (tables: apartments)
Question: Find the average room count of the apartments that have the "Studio" type code.
SQL: SELECT avg(room_count) FROM Apartments WHERE apt_type_code  =  "Studio"
Database: apartment_rentals (tables: apartments)
Question: Return the apartment numbers of the apartments with type code "Flat".
SQL: SELECT apt_number FROM Apartments WHERE apt_type_code  =  "Flat"
Database: apartment_rentals (tables: apartments)
Question: Which apartments have type code "Flat"? Give me their apartment numbers.
SQL: SELECT apt_number FROM Apartments WHERE apt_type_code  =  "Flat"
Database: apartment_rentals (tables: guests)
Question: Return the first names and last names of all guests
SQL: SELECT guest_first_name ,  guest_last_name FROM Guests
Database: apartment_rentals (tables: guests)
Question: What are the first names and last names of all the guests?
SQL: SELECT guest_first_name ,  guest_last_name FROM Guests
Database: apartment_rentals (tables: guests)
Question: Return the date of birth for all the guests with gender code "Male".
SQL: SELECT date_of_birth FROM Guests WHERE gender_code  =  "Male"
Database: apartment_rentals (tables: guests)
Question: What are dates of birth of all the guests whose gender is "Male"?
SQL: SELECT date_of_birth FROM Guests WHERE gender_code  =  "Male"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Show the apartment numbers, start dates, and end dates of all the apartment bookings.
SQL: SELECT T2.apt_number ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: What are the apartment number, start date, and end date of each apartment booking?
SQL: SELECT T2.apt_number ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: What are the booking start and end dates of the apartments with type code "Duplex"?
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_type_code  =  "Duplex"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Return the booking start date and end date for the apartments that have type code "Duplex".
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_type_code  =  "Duplex"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: What are the booking start and end dates of the apartments with more than 2 bedrooms?
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.bedroom_count  >  2
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Find the booking start date and end date for the apartments that have more than two bedrooms.
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.bedroom_count  >  2
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: What is the booking status code of the apartment with apartment number "Suite 634"?
SQL: SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_number  =  "Suite 634"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Tell me the booking status code for the apartment with number "Suite 634".
SQL: SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_number  =  "Suite 634"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed".
SQL: SELECT DISTINCT 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"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Which apartments have bookings with status code "Confirmed"? Return their apartment numbers.
SQL: SELECT DISTINCT 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"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: Show the average room count of the apartments that have booking status code "Provisional".
SQL: SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Provisional"
Database: apartment_rentals (tables: apartments, apartment_bookings)
Question: What is the average room count of the apartments whose booking status code is "Provisional"?
SQL: SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Provisional"
Database: apartment_rentals (tables: apartment_bookings, guests)
Question: Show the guest first names, start dates, and end dates of all the apartment bookings.
SQL: SELECT T2.guest_first_name ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id
Database: apartment_rentals (tables: apartment_bookings, guests)
Question: What are the guest first name, start date, and end date of each apartment booking?
SQL: SELECT T2.guest_first_name ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id
Database: apartment_rentals (tables: apartment_bookings, guests)
Question: Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female".
SQL: 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"
Database: apartment_rentals (tables: apartment_bookings, guests)
Question: What are the start date and end date of the apartment bookings made by female guests (gender code "Female")?
SQL: 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"
Database: apartment_rentals (tables: apartment_bookings, guests)
Question: Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".
SQL: 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"
Database: apartment_rentals (tables: apartment_bookings, guests)
Question: Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names.
SQL: 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"
Database: apartment_rentals (tables: apartment_facilities, apartments)
Question: Show the facility codes of apartments with more than 4 bedrooms.
SQL: 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
Database: apartment_rentals (tables: apartment_facilities, apartments)
Question: What are the facility codes of the apartments with more than four bedrooms?
SQL: 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
Database: apartment_rentals (tables: apartment_facilities, apartments)
Question: Show the total number of rooms of all apartments with facility code "Gym".
SQL: 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"
Database: apartment_rentals (tables: apartment_facilities, apartments)
Question: Find the total number of rooms in the apartments that have facility code "Gym".
SQL: 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"
Database: apartment_rentals (tables: apartment_buildings, apartments)
Question: Show the total number of rooms of the apartments in the building with short name "Columbus Square".
SQL: 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"
Database: apartment_rentals (tables: apartment_buildings, apartments)
Question: How many rooms in total are there in the apartments in the building with short name "Columbus Square"?
SQL: 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"
Database: apartment_rentals (tables: apartment_buildings, apartments)
Question: Show the addresses of the buildings that have apartments with more than 2 bathrooms.
SQL: 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
Database: apartment_rentals (tables: apartment_buildings, apartments)
Question: Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings.
SQL: 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
Database: apartment_rentals (tables: apartment_buildings, apartments)
Question: Show the apartment type codes and apartment numbers in the buildings managed by "Kyle".
SQL: 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"
Database: apartment_rentals (tables: apartment_buildings, apartments)
Question: What apartment type codes and apartment numbers do the buildings managed by "Kyle" have?
SQL: 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"
Database: apartment_rentals (tables: apartment_bookings)
Question: Show the booking status code and the corresponding number of bookings.
SQL: SELECT 	booking_status_code ,  COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
Database: apartment_rentals (tables: apartment_bookings)
Question: How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.
SQL: SELECT 	booking_status_code ,  COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
Database: apartment_rentals (tables: apartments)
Question: Return all the apartment numbers sorted by the room count in ascending order.
SQL: SELECT apt_number FROM Apartments ORDER BY room_count ASC
Database: apartment_rentals (tables: apartments)
Question: Sort the apartment numbers in ascending order of room count.
SQL: SELECT apt_number FROM Apartments ORDER BY room_count ASC
Database: apartment_rentals (tables: apartments)
Question: Return the apartment number with the largest number of bedrooms.
SQL: SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
Database: apartment_rentals (tables: apartments)
Question: What is the apartment number of the apartment with the most beds?
SQL: SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
Database: apartment_rentals (tables: apartments)
Question: Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.
SQL: SELECT apt_type_code ,  COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC