brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Show the short names of the buildings managed by "Emma".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the short names of the buildings managed by "Emma".` to a syntactically-correct PostgreSQL query.
SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma"
Which buildings does "Emma" manage? Give me the short names of the buildings.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which buildings does "Emma" manage? Give me the short names of the buildings.` to a syntactically-correct PostgreSQL query.
SELECT building_short_name FROM Apartment_Buildings WHERE building_manager = "Emma"
Show the addresses and phones of all the buildings managed by "Brenden".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the addresses and phones of all the buildings managed by "Brenden".` to a syntactically-correct PostgreSQL query.
SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden"
What are the address and phone number of the buildings managed by "Brenden"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the address and phone number of the buildings managed by "Brenden"?` to a syntactically-correct PostgreSQL query.
SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager = "Brenden"
What are the building full names that contain the word "court"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the building full names that contain the word "court"?` to a syntactically-correct PostgreSQL query.
SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"
Find all the building full names containing the word "court".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find all the building full names containing the word "court".` to a syntactically-correct PostgreSQL query.
SELECT building_full_name FROM Apartment_Buildings WHERE building_full_name LIKE "%court%"
What is the minimum and maximum number of bathrooms of all the apartments?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the minimum and maximum number of bathrooms of all the apartments?` to a syntactically-correct PostgreSQL query.
SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments
Give me the minimum and maximum bathroom count among all the apartments.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Give me the minimum and maximum bathroom count among all the apartments.` to a syntactically-correct PostgreSQL query.
SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments
What is the average number of bedrooms of all apartments?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average number of bedrooms of all apartments?` to a syntactically-correct PostgreSQL query.
SELECT avg(bedroom_count) FROM Apartments
Find the average number of bedrooms of all the apartments.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the average number of bedrooms of all the apartments.` to a syntactically-correct PostgreSQL query.
SELECT avg(bedroom_count) FROM Apartments
Return the apartment number and the number of rooms for each apartment.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the apartment number and the number of rooms for each apartment.` to a syntactically-correct PostgreSQL query.
SELECT apt_number , room_count FROM Apartments
What are the apartment number and the room count of each apartment?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the apartment number and the room count of each apartment?` to a syntactically-correct PostgreSQL query.
SELECT apt_number , room_count FROM Apartments
What is the average number of rooms of apartments with type code "Studio"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average number of rooms of apartments with type code "Studio"?` to a syntactically-correct PostgreSQL query.
SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio"
Find the average room count of the apartments that have the "Studio" type code.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the average room count of the apartments that have the "Studio" type code.` to a syntactically-correct PostgreSQL query.
SELECT avg(room_count) FROM Apartments WHERE apt_type_code = "Studio"
Return the apartment numbers of the apartments with type code "Flat".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the apartment numbers of the apartments with type code "Flat".` to a syntactically-correct PostgreSQL query.
SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat"
Which apartments have type code "Flat"? Give me their apartment numbers.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartments have type code "Flat"? Give me their apartment numbers.` to a syntactically-correct PostgreSQL query.
SELECT apt_number FROM Apartments WHERE apt_type_code = "Flat"
Return the first names and last names of all guests
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the first names and last names of all guests` to a syntactically-correct PostgreSQL query.
SELECT guest_first_name , guest_last_name FROM Guests
What are the first names and last names of all the guests?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the first names and last names of all the guests?` to a syntactically-correct PostgreSQL query.
SELECT guest_first_name , guest_last_name FROM Guests
Return the date of birth for all the guests with gender code "Male".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the date of birth for all the guests with gender code "Male".` to a syntactically-correct PostgreSQL query.
SELECT date_of_birth FROM Guests WHERE gender_code = "Male"
What are dates of birth of all the guests whose gender is "Male"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are dates of birth of all the guests whose gender is "Male"?` to a syntactically-correct PostgreSQL query.
SELECT date_of_birth FROM Guests WHERE gender_code = "Male"
Show the apartment numbers, start dates, and end dates of all the apartment bookings.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the apartment numbers, start dates, and end dates of all the apartment bookings.` to a syntactically-correct PostgreSQL query.
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
What are the apartment number, start date, and end date of each apartment booking?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the apartment number, start date, and end date of each apartment booking?` to a syntactically-correct PostgreSQL query.
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
What are the booking start and end dates of the apartments with type code "Duplex"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the booking start and end dates of the apartments with type code "Duplex"?` to a syntactically-correct PostgreSQL query.
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"
Return the booking start date and end date for the apartments that have type code "Duplex".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the booking start date and end date for the apartments that have type code "Duplex".` to a syntactically-correct PostgreSQL query.
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"
What are the booking start and end dates of the apartments with more than 2 bedrooms?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the booking start and end dates of the apartments with more than 2 bedrooms?` to a syntactically-correct PostgreSQL query.
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
Find the booking start date and end date for the apartments that have more than two bedrooms.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the booking start date and end date for the apartments that have more than two bedrooms.` to a syntactically-correct PostgreSQL query.
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
What is the booking status code of the apartment with apartment number "Suite 634"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the booking status code of the apartment with apartment number "Suite 634"?` to a syntactically-correct PostgreSQL query.
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"
Tell me the booking status code for the apartment with number "Suite 634".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Tell me the booking status code for the apartment with number "Suite 634".` to a syntactically-correct PostgreSQL query.
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"
Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the distinct apartment numbers of the apartments that have bookings with status code "Confirmed".` to a syntactically-correct PostgreSQL query.
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"
Which apartments have bookings with status code "Confirmed"? Return their apartment numbers.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartments have bookings with status code "Confirmed"? Return their apartment numbers.` to a syntactically-correct PostgreSQL query.
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"
Show the average room count of the apartments that have booking status code "Provisional".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the average room count of the apartments that have booking status code "Provisional".` to a syntactically-correct PostgreSQL query.
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"
What is the average room count of the apartments whose booking status code is "Provisional"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average room count of the apartments whose booking status code is "Provisional"?` to a syntactically-correct PostgreSQL query.
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"
Show the guest first names, start dates, and end dates of all the apartment bookings.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the guest first names, start dates, and end dates of all the apartment bookings.` to a syntactically-correct PostgreSQL query.
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
What are the guest first name, start date, and end date of each apartment booking?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the guest first name, start date, and end date of each apartment booking?` to a syntactically-correct PostgreSQL query.
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
Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the start dates and end dates of all the apartment bookings made by guests with gender code "Female".` to a syntactically-correct PostgreSQL query.
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"
What are the start date and end date of the apartment bookings made by female guests (gender code "Female")?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the start date and end date of the apartment bookings made by female guests (gender code "Female")?` to a syntactically-correct PostgreSQL query.
SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female"
Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".` to a syntactically-correct PostgreSQL query.
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"
Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names.` to a syntactically-correct PostgreSQL query.
SELECT T2.guest_first_name , T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T1.booking_status_code = "Confirmed"
Show the facility codes of apartments with more than 4 bedrooms.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the facility codes of apartments with more than 4 bedrooms.` to a syntactically-correct PostgreSQL query.
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
What are the facility codes of the apartments with more than four bedrooms?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the facility codes of the apartments with more than four bedrooms?` to a syntactically-correct PostgreSQL query.
SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4
Show the total number of rooms of all apartments with facility code "Gym".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the total number of rooms of all apartments with facility code "Gym".` to a syntactically-correct PostgreSQL query.
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"
Find the total number of rooms in the apartments that have facility code "Gym".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the total number of rooms in the apartments that have facility code "Gym".` to a syntactically-correct PostgreSQL query.
SELECT sum(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.facility_code = "Gym"
Show the total number of rooms of the apartments in the building with short name "Columbus Square".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the total number of rooms of the apartments in the building with short name "Columbus Square".` to a syntactically-correct PostgreSQL query.
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"
How many rooms in total are there in the apartments in the building with short name "Columbus Square"?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many rooms in total are there in the apartments in the building with short name "Columbus Square"?` to a syntactically-correct PostgreSQL query.
SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_short_name = "Columbus Square"
Show the addresses of the buildings that have apartments with more than 2 bathrooms.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the addresses of the buildings that have apartments with more than 2 bathrooms.` to a syntactically-correct PostgreSQL query.
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
Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings.` to a syntactically-correct PostgreSQL query.
SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T2.bathroom_count > 2
Show the apartment type codes and apartment numbers in the buildings managed by "Kyle".
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the apartment type codes and apartment numbers in the buildings managed by "Kyle".` to a syntactically-correct PostgreSQL query.
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"
What apartment type codes and apartment numbers do the buildings managed by "Kyle" have?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What apartment type codes and apartment numbers do the buildings managed by "Kyle" have?` to a syntactically-correct PostgreSQL query.
SELECT T2.apt_type_code , T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle"
Show the booking status code and the corresponding number of bookings.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the booking status code and the corresponding number of bookings.` to a syntactically-correct PostgreSQL query.
SELECT booking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.` to a syntactically-correct PostgreSQL query.
SELECT booking_status_code , COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
Return all the apartment numbers sorted by the room count in ascending order.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return all the apartment numbers sorted by the room count in ascending order.` to a syntactically-correct PostgreSQL query.
SELECT apt_number FROM Apartments ORDER BY room_count ASC
Sort the apartment numbers in ascending order of room count.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Sort the apartment numbers in ascending order of room count.` to a syntactically-correct PostgreSQL query.
SELECT apt_number FROM Apartments ORDER BY room_count ASC
Return the apartment number with the largest number of bedrooms.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return the apartment number with the largest number of bedrooms.` to a syntactically-correct PostgreSQL query.
SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
What is the apartment number of the apartment with the most beds?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the apartment number of the apartment with the most beds?` to a syntactically-correct PostgreSQL query.
SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC
Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code , COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC
Show the top 3 apartment type codes sorted by the average number of rooms in descending order.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the top 3 apartment type codes sorted by the average number of rooms in descending order.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3
What are the top three apartment types in terms of the average room count? Give me the
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the top three apartment types in terms of the average room count? Give me the` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3
Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1
Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1
Show the most common apartment type code.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the most common apartment type code.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Which apartment type code appears the most often?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartment type code appears the most often?` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Show the most common apartment type code among apartments with more than 1 bathroom.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the most common apartment type code among apartments with more than 1 bathroom.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Which apartment type code is the most common among apartments with more than one bathroom?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartment type code is the most common among apartments with more than one bathroom?` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code FROM Apartments WHERE bathroom_count > 1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
Show each apartment type code, and the maximum and minimum number of rooms for each type.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show each apartment type code, and the maximum and minimum number of rooms for each type.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code
Return each apartment type code along with the maximum and minimum number of rooms among each type.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Return each apartment type code along with the maximum and minimum number of rooms among each type.` to a syntactically-correct PostgreSQL query.
SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code
Show each gender code and the corresponding count of guests sorted by the count in descending order.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show each gender code and the corresponding count of guests sorted by the count in descending order.` to a syntactically-correct PostgreSQL query.
SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Sort the gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts.` to a syntactically-correct PostgreSQL query.
SELECT gender_code , COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
How many apartments do not have any facility?
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many apartments do not have any facility?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)
Find the number of apartments that have no facility.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the number of apartments that have no facility.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)
Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed"
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the apartment numbers of apartments with bookings that have status code both "Provisional" and "Confirmed"` to a syntactically-correct PostgreSQL query.
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"
Which apartments have bookings with both status codes "Provisional" and "Confirmed"? Give me the apartment numbers.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartments have bookings with both status codes "Provisional" and "Confirmed"? Give me the apartment numbers.` to a syntactically-correct PostgreSQL query.
SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"
Show the apartment numbers of apartments with unit status availability of both 0 and 1.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the apartment numbers of apartments with unit status availability of both 0 and 1.` to a syntactically-correct PostgreSQL query.
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
Which apartments have unit status availability of both 0 and 1? Return their apartment numbers.
-- Language PostgreSQL -- Tables: -- Table: apartment buildings columns : [['building id', 'number'], ['building short name', 'text'], ['building full name', 'text'], ['building description', 'text'], ['building address', 'text'], ['building manager', 'text'], ['building phone', 'text']] -- Table: apartments columns : [['apartment id', 'number'], ['building id', 'number'], ['apartment type code', 'text'], ['apartment number', 'text'], ['bathroom count', 'number'], ['bedroom count', 'number'], ['room count', 'text']] -- Table: apartment facilities columns : [['apartment id', 'number'], ['facility code', 'text']] -- Table: guests columns : [['guest id', 'number'], ['gender code', 'text'], ['guest first name', 'text'], ['guest last name', 'text'], ['date of birth', 'time']] -- Table: apartment bookings columns : [['apartment booking id', 'number'], ['apartment id', 'number'], ['guest id', 'number'], ['booking status code', 'text'], ['booking start date', 'time'], ['booking end date', 'time']] -- Table: view unit status columns : [['apartment id', 'number'], ['apartment booking id', 'number'], ['status date', 'time'], ['available yes or no', 'others']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which apartments have unit status availability of both 0 and 1? Return their apartment numbers.` to a syntactically-correct PostgreSQL query.
SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id = T2.apt_id WHERE T2.available_yn = 1
How many games are held after season 2007?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many games are held after season 2007?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM game WHERE season > 2007
List the dates of games by the home team name in descending order.
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the dates of games by the home team name in descending order.` to a syntactically-correct PostgreSQL query.
SELECT Date FROM game ORDER BY home_team DESC
List the season, home team, away team of all the games.
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the season, home team, away team of all the games.` to a syntactically-correct PostgreSQL query.
SELECT season , home_team , away_team FROM game
What are the maximum, minimum and average home games each stadium held?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the maximum, minimum and average home games each stadium held?` to a syntactically-correct PostgreSQL query.
SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium
What is the average attendance of stadiums with capacity percentage higher than 100%?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average attendance of stadiums with capacity percentage higher than 100%?` to a syntactically-correct PostgreSQL query.
SELECT average_attendance FROM stadium WHERE capacity_percentage > 100
What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?` to a syntactically-correct PostgreSQL query.
SELECT player , number_of_matches , SOURCE FROM injury_accident WHERE injury != 'Knee problem'
What is the season of the game which causes the player 'Walter Samuel' to get injured?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the season of the game which causes the player 'Walter Samuel' to get injured?` to a syntactically-correct PostgreSQL query.
SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'
What are the ids, scores, and dates of the games which caused at least two injury accidents?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the ids, scores, and dates of the games which caused at least two injury accidents?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.score , T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
What are the id and name of the stadium where the most injury accidents happened?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the id and name of the stadium where the most injury accidents happened?` to a syntactically-correct PostgreSQL query.
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
Find the id and name of the stadium where the largest number of injury accidents occurred.
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the id and name of the stadium where the largest number of injury accidents occurred.` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?` to a syntactically-correct PostgreSQL query.
SELECT T1.season , T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'
How many different kinds of information sources are there for injury accidents?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many different kinds of information sources are there for injury accidents?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT SOURCE) FROM injury_accident
How many games are free of injury accidents?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many games are free of injury accidents?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )
How many distinct kinds of injuries happened after season 2010?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many distinct kinds of injuries happened after season 2010?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010
List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'
Show the name, average attendance, total attendance for stadiums where no accidents happened.
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Show the name, average attendance, total attendance for stadiums where no accidents happened.` to a syntactically-correct PostgreSQL query.
SELECT name , average_attendance , total_attendance FROM stadium EXCEPT SELECT T2.name , T2.average_attendance , T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id
Which stadium name contains the substring "Bank"?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Which stadium name contains the substring "Bank"?` to a syntactically-correct PostgreSQL query.
SELECT name FROM stadium WHERE name LIKE "%Bank%"
How many games has each stadium held?
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many games has each stadium held?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id
For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.
-- Language PostgreSQL -- Tables: -- Table: stadium columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']] -- Table: game columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']] -- Table: injury accident columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `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.` to a syntactically-correct PostgreSQL query.
SELECT T1.date , T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC
List all country and league names.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all country and league names.` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id
How many leagues are there in England?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `How many leagues are there in England?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = "England"
What is the average weight of all players?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the average weight of all players?` to a syntactically-correct PostgreSQL query.
SELECT avg(weight) FROM Player
What is the maximum and minimum height of all players?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the maximum and minimum height of all players?` to a syntactically-correct PostgreSQL query.
SELECT max(weight) , min(weight) FROM Player
List all player names who have an overall rating higher than the average.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List all player names who have an overall rating higher than the average.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating > ( SELECT avg(overall_rating) FROM Player_Attributes )
What are the names of players who have the best dribbling?
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What are the names of players who have the best dribbling?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling = ( SELECT max(overall_rating) FROM Player_Attributes)
List the names of all players who have a crossing score higher than 90 and prefer their right foot.
-- Language PostgreSQL -- Tables: -- Table: player attributes columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']] -- Table: sqlite sequence columns : [['name', 'text'], ['seq', 'text']] -- Table: player columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']] -- Table: league columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']] -- Table: country columns : [['id', 'number'], ['name', 'text']] -- Table: team columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']] -- Table: team attributes columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `List the names of all players who have a crossing score higher than 90 and prefer their right foot.` to a syntactically-correct PostgreSQL query.
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"