sert121/SpiderSQL huggingface dataset:
-- 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.



Question: What are the start date and end date of the apartment bookings made by female guests (gender code "Female")?
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id WHERE T2.gender_code  =  "Female"
-- 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.



Question: Show the first names and last names of all the guests that have apartment bookings with status code "Confirmed".
SQL: SELECT T2.guest_first_name ,  T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id WHERE T1.booking_status_code  =  "Confirmed"
-- 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.



Question: Which guests have apartment bookings with status code "Confirmed"? Return their first names and last names.
SQL: SELECT T2.guest_first_name ,  T2.guest_last_name FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id WHERE T1.booking_status_code  =  "Confirmed"
-- 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.



Question: Show the facility codes of apartments with more than 4 bedrooms.
SQL: SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.bedroom_count  >  4
-- 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.



Question: What are the facility codes of the apartments with more than four bedrooms?
SQL: SELECT T1.facility_code FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.bedroom_count  >  4
-- 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.



Question: Show the total number of rooms of all apartments with facility code "Gym".
SQL: SELECT sum(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.facility_code  =  "Gym"
-- 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.



Question: Find the total number of rooms in the apartments that have facility code "Gym".
SQL: SELECT sum(T2.room_count) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.facility_code  =  "Gym"
-- 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.



Question: Show the total number of rooms of the apartments in the building with short name "Columbus Square".
SQL: SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id  =  T2.building_id WHERE T1.building_short_name  =  "Columbus Square"
-- 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.



Question: How many rooms in total are there in the apartments in the building with short name "Columbus Square"?
SQL: SELECT sum(T2.room_count) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id  =  T2.building_id WHERE T1.building_short_name  =  "Columbus Square"
-- 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.



Question: Show the addresses of the buildings that have apartments with more than 2 bathrooms.
SQL: SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id  =  T2.building_id WHERE T2.bathroom_count  >  2
-- 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.



Question: Which buildings have apartments that have more than two bathrooms? Give me the addresses of the buildings.
SQL: SELECT T1.building_address FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id  =  T2.building_id WHERE T2.bathroom_count  >  2
-- 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.



Question: Show the apartment type codes and apartment numbers in the buildings managed by "Kyle".
SQL: SELECT T2.apt_type_code ,  T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id  =  T2.building_id WHERE T1.building_manager  =  "Kyle"
-- 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.



Question: What apartment type codes and apartment numbers do the buildings managed by "Kyle" have?
SQL: SELECT T2.apt_type_code ,  T2.apt_number FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id  =  T2.building_id WHERE T1.building_manager  =  "Kyle"
-- 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.



Question: Show the booking status code and the corresponding number of bookings.
SQL: SELECT 	booking_status_code ,  COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
-- 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.



Question: How many bookings does each booking status have? List the booking status code and the number of corresponding bookings.
SQL: SELECT 	booking_status_code ,  COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
-- 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.



Question: Return all the apartment numbers sorted by the room count in ascending order.
SQL: SELECT apt_number FROM Apartments ORDER BY room_count ASC
-- 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.



Question: Sort the apartment numbers in ascending order of room count.
SQL: SELECT apt_number FROM Apartments ORDER BY room_count ASC
-- 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.



Question: Return the apartment number with the largest number of bedrooms.
SQL: SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 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.



Question: What is the apartment number of the apartment with the most beds?
SQL: SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
-- 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.



Question: Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order.
SQL: SELECT apt_type_code ,  COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC
-- 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.



Question: Return each apartment type code with the number of apartments having that apartment type, in ascending order of the number of apartments.
SQL: SELECT apt_type_code ,  COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*) ASC
-- 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.



Question: Show the top 3 apartment type codes sorted by the average number of rooms in descending order.
SQL: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3
-- 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.



Question: What are the top three apartment types in terms of the average room count? Give me the
SQL: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY avg(room_count) DESC LIMIT 3
-- 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.



Question: Show the apartment type code that has the largest number of total rooms, together with the number of bathrooms and number of bedrooms.
SQL: SELECT apt_type_code ,  bathroom_count ,  bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1
-- 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.



Question: Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms.
SQL: SELECT apt_type_code ,  bathroom_count ,  bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1
-- 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.



Question: Show the most common apartment type code.
SQL: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
-- 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.



Question: Which apartment type code appears the most often?
SQL: SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
-- 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.



Question: Show the most common apartment type code among apartments with more than 1 bathroom.
SQL: SELECT apt_type_code FROM Apartments WHERE bathroom_count  >  1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1