SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the short names of the buildings managed by "Emma". |
SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which buildings does "Emma" manage? Give me the short names of the buildings. |
SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the addresses and phones of all the buildings managed by "Brenden". |
SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the address and phone number of the buildings managed by "Brenden"? |
SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the building full names that contain the word "court"? |
SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Find all the building full names containing the word "court". |
SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What is the minimum and maximum number of bathrooms of all the apartments? |
SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Give me the minimum and maximum bathroom count among all the apartments. |
SELECT avg(bedroom_count) FROM Apartments | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What is the average number of bedrooms of all apartments? |
SELECT avg(bedroom_count) FROM Apartments | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Find the average number of bedrooms of all the apartments. |
SELECT apt_number , room_count FROM Apartments | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return the apartment number and the number of rooms for each apartment. |
SELECT apt_number , room_count FROM Apartments | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the apartment number and the room count of each apartment? |
SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What is the average number of rooms of apartments with type code "Studio"? |
SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Find the average room count of the apartments that have the "Studio" type code. |
SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return the apartment numbers of the apartments with type code "Flat". |
SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartments have type code "Flat"? Give me their apartment numbers. |
SELECT guest_first_name , guest_last_name FROM Guests | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return the first names and last names of all guests |
SELECT guest_first_name , guest_last_name FROM Guests | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the first names and last names of all the guests? |
SELECT date_of_birth FROM Guests WHERE gender_code = "Male" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return the date of birth for all the guests with gender code "Male". |
SELECT date_of_birth FROM Guests WHERE gender_code = "Male" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are dates of birth of all the guests whose gender is "Male"? |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the apartment numbers, start dates, and end dates of all the apartment bookings. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the apartment number, start date, and end date of each apartment booking? |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the booking start and end dates of the apartments with type code "Duplex"? |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return the booking start date and end date for the apartments that have type code "Duplex". |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the booking start and end dates of the apartments with more than 2 bedrooms? |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Find the booking start date and end date for the apartments that have more than two bedrooms. |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What is the booking status code of the apartment with apartment number "Suite 634"? |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Tell me the booking status code for the apartment with number "Suite 634". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartments have bookings with status code "Confirmed"? Return their apartment numbers. |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the average room count of the apartments that have booking status code "Provisional". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What is the average room count of the apartments whose booking status code is "Provisional"? |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the guest first names, start dates, and end dates of all the apartment bookings. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the guest first name, start date, and end date of each apartment booking? |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the start date and end date of the apartment bookings made by female guests (gender code "Female")? |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the facility codes of apartments with more than 4 bedrooms. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the facility codes of the apartments with more than four bedrooms? |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the total number of rooms of all apartments with facility code "Gym". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Find the total number of rooms in the apartments that have facility code "Gym". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the total number of rooms of the apartments in the building with short name "Columbus Square". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. How many rooms in total are there in the apartments in the building with short name "Columbus Square"? |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the addresses of the buildings that have apartments with more than 2 bathrooms. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings. |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the apartment type codes and apartment numbers in the buildings managed by "Kyle". |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What apartment type codes and apartment numbers do the buildings managed by "Kyle" have? |
SELECT booking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the booking status code and the corresponding number of bookings. |
SELECT booking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. How many bookings does each booking status have? List the booking status code and the number of corresponding bookings. |
SELECT apt_number FROM Apartments ORDER BY room_count ASC | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return all the apartment numbers sorted by the room count in ascending order. |
SELECT apt_number FROM Apartments ORDER BY room_count ASC | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Sort the apartment numbers in ascending order of room count. |
SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return the apartment number with the largest number of bedrooms. |
SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What is the apartment number of the apartment with the most beds? |
SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. |
SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments. |
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the top 3 apartment type codes sorted by the average number of rooms in descending order. |
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the top three apartment types in terms of the average room count? Give me the |
SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms. |
SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms. |
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the most common apartment type code. |
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartment type code appears the most often? |
SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the most common apartment type code among apartments with more than 1 bathroom. |
SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartment type code is the most common among apartments with more than one bathroom? |
SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show each apartment type code, and the maximum and minimum number of rooms for each type. |
SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Return each apartment type code along with the maximum and minimum number of rooms among each type. |
SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show each gender code and the corresponding count of guests sorted by the count in descending order. |
SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts. |
SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities) | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. How many apartments do not have any facility? |
SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities) | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Find the number of apartments that have no facility. |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed" |
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" | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartments have bookings with both status codes "Provisional" and "Confirmed"? Give me the apartment numbers. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the apartment numbers of apartments with unit status availability of both 0 and 1. |
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 | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Which apartments have unit status availability of both 0 and 1? Return their apartment numbers. |
SELECT count(*) FROM game WHERE season > 2007 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. How many games are held after season 2007? |
SELECT Date FROM game ORDER BY home_team DESC | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. List the dates of games by the home team name in descending order. |
SELECT season , home_team , away_team FROM game | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. List the season, home team, away team of all the games. |
SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the maximum, minimum and average home games each stadium held? |
SELECT average_attendance FROM stadium WHERE capacity_percentage > 100 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. What is the average attendance of stadiums with capacity percentage higher than 100%? |
SELECT player , number_of_matches , SOURCE FROM injury_accident WHERE injury != 'Knee problem' | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'? |
SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel' | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. What is the season of the game which causes the player 'Walter Samuel' to get injured? |
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 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the ids, scores, and dates of the games which caused at least two injury accidents? |
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 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. What are the id and name of the stadium where the most injury accidents happened? |
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 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. Find the id and name of the stadium where the largest number of injury accidents occurred. |
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' | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'? |
SELECT count(DISTINCT SOURCE) FROM injury_accident | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. How many different kinds of information sources are there for injury accidents? |
SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident ) | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. How many games are free of injury accidents? |
SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. How many distinct kinds of injuries happened after season 2010? |
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' | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured. |
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 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. Show the name, average attendance, total attendance for stadiums where no accidents happened. |
SELECT name FROM stadium WHERE name LIKE "%Bank%" | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. Which stadium name contains the substring "Bank"? |
SELECT T1.id , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. How many games has each stadium held? |
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 | Given the Table stadium having columns as id has datatype number, name has datatype text, Home_Games has datatype number, Average_Attendance has datatype number, Total_Attendance has datatype number, Capacity_Percentage has datatype number which has id and Given the Table game having columns as stadium_id has datatype number, id has datatype number, Season has datatype number, Date has datatype text, Home_team has datatype text, Away_team has datatype text, Score has datatype text, Competition has datatype text which has id and Given the Table injury accident having columns as game_id has datatype number, id has datatype number, Player has datatype text, Injury has datatype text, Number_of_matches has datatype text, Source has datatype text which has id. Answer the question by writing the appropriate SQL code. 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. |
SELECT T1.name , T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List all country and league names. |
SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England" | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many leagues are there in England? |
SELECT avg(weight) FROM Player | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the average weight of all players? |
SELECT max(weight) , min(weight) FROM Player | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the maximum and minimum height of all players? |
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 ) | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List all player names who have an overall rating higher than the average. |
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) | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of players who have the best dribbling? |
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" | Given the Table player attributes having columns as id has datatype number, player_fifa_api_id has datatype number, player_api_id has datatype number, date has datatype text, overall_rating has datatype number, potential has datatype number, preferred_foot has datatype text, attacking_work_rate has datatype text, defensive_work_rate has datatype text, crossing has datatype number, finishing has datatype number, heading_accuracy has datatype number, short_passing has datatype number, volleys has datatype number, dribbling has datatype number, curve has datatype number, free_kick_accuracy has datatype number, long_passing has datatype number, ball_control has datatype number, acceleration has datatype number, sprint_speed has datatype number, agility has datatype number, reactions has datatype number, balance has datatype number, shot_power has datatype number, jumping has datatype number, stamina has datatype number, strength has datatype number, long_shots has datatype number, aggression has datatype number, interceptions has datatype number, positioning has datatype number, vision has datatype number, penalties has datatype number, marking has datatype number, standing_tackle has datatype number, sliding_tackle has datatype number, gk_diving has datatype number, gk_handling has datatype number, gk_kicking has datatype number, gk_positioning has datatype number, gk_reflexes has datatype number which has id and Given the Table sqlite sequence having columns as name has datatype text, seq has datatype text which has id and Given the Table player having columns as id has datatype number, player_api_id has datatype number, player_name has datatype text, player_fifa_api_id has datatype number, birthday has datatype text, height has datatype number, weight has datatype number which has id and Given the Table league having columns as id has datatype number, country_id has datatype number, name has datatype text which has id and Given the Table country having columns as id has datatype number, name has datatype text which has id and Given the Table team having columns as id has datatype number, team_api_id has datatype number, team_fifa_api_id has datatype number, team_long_name has datatype text, team_short_name has datatype text which has id and Given the Table team attributes having columns as id has datatype number, team_fifa_api_id has datatype number, team_api_id has datatype number, date has datatype text, buildUpPlaySpeed has datatype number, buildUpPlaySpeedClass has datatype text, buildUpPlayDribbling has datatype number, buildUpPlayDribblingClass has datatype text, buildUpPlayPassing has datatype number, buildUpPlayPassingClass has datatype text, buildUpPlayPositioningClass has datatype text, chanceCreationPassing has datatype number, chanceCreationPassingClass has datatype text, chanceCreationCrossing has datatype number, chanceCreationCrossingClass has datatype text, chanceCreationShooting has datatype number, chanceCreationShootingClass has datatype text, chanceCreationPositioningClass has datatype text, defencePressure has datatype number, defencePressureClass has datatype text, defenceAggression has datatype number, defenceAggressionClass has datatype text, defenceTeamWidth has datatype number, defenceTeamWidthClass has datatype text, defenceDefenderLineClass has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. List the names of all players who have a crossing score higher than 90 and prefer their right foot. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.