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