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: Give me the minimum and maximum bathroom count among all the apartments.
SQL: SELECT min(bathroom_count) ,  max(bathroom_count) FROM 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.



Question: What is the average number of bedrooms of all apartments?
SQL: SELECT avg(bedroom_count) FROM 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.



Question: Find the average number of bedrooms of all the apartments.
SQL: SELECT avg(bedroom_count) FROM 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.



Question: Return the apartment number and the number of rooms for each apartment.
SQL: SELECT apt_number ,  room_count FROM 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.



Question: What are the apartment number and the room count of each apartment?
SQL: SELECT apt_number ,  room_count FROM 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.



Question: What is the average number of rooms of apartments with type code "Studio"?
SQL: SELECT avg(room_count) FROM Apartments WHERE apt_type_code  =  "Studio"
-- 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 average room count of the apartments that have the "Studio" type code.
SQL: SELECT avg(room_count) FROM Apartments WHERE apt_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.



Question: Return the apartment numbers of the apartments with type code "Flat".
SQL: SELECT apt_number FROM Apartments WHERE apt_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.



Question: Which apartments have type code "Flat"? Give me their apartment numbers.
SQL: SELECT apt_number FROM Apartments WHERE apt_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.



Question: Return the first names and last names of all guests
SQL: SELECT guest_first_name ,  guest_last_name FROM 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.



Question: What are the first names and last names of all the guests?
SQL: SELECT guest_first_name ,  guest_last_name FROM 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.



Question: Return the date of birth for all the guests with gender code "Male".
SQL: SELECT date_of_birth FROM Guests WHERE gender_code  =  "Male"
-- 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 dates of birth of all the guests whose gender is "Male"?
SQL: SELECT date_of_birth FROM Guests WHERE 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.



Question: Show the apartment numbers, start dates, and end dates of all the apartment bookings.
SQL: SELECT T2.apt_number ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id
-- 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 apartment number, start date, and end date of each apartment booking?
SQL: SELECT T2.apt_number ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id
-- 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 booking start and end dates of the apartments with type code "Duplex"?
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_type_code  =  "Duplex"
-- 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 booking start date and end date for the apartments that have type code "Duplex".
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_type_code  =  "Duplex"
-- 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 booking start and end dates of the apartments with more than 2 bedrooms?
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.bedroom_count  >  2
-- 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 booking start date and end date for the apartments that have more than two bedrooms.
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.bedroom_count  >  2
-- 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 booking status code of the apartment with apartment number "Suite 634"?
SQL: SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_number  =  "Suite 634"
-- 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: Tell me the booking status code for the apartment with number "Suite 634".
SQL: SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.apt_number  =  "Suite 634"
-- 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 distinct apartment numbers of the apartments that have bookings with status code "Confirmed".
SQL: SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Confirmed"
-- 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 apartments have bookings with status code "Confirmed"? Return their apartment numbers.
SQL: SELECT DISTINCT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Confirmed"
-- 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 average room count of the apartments that have booking status code "Provisional".
SQL: SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Provisional"
-- 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 average room count of the apartments whose booking status code is "Provisional"?
SQL: SELECT avg(room_count) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Provisional"
-- 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 guest first names, start dates, and end dates of all the apartment bookings.
SQL: SELECT T2.guest_first_name ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id
-- 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 guest first name, start date, and end date of each apartment booking?
SQL: SELECT T2.guest_first_name ,  T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id
-- 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 start dates and end dates of all the apartment bookings made by guests with gender code "Female".
SQL: SELECT T1.booking_start_date ,  T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id  =  T2.guest_id WHERE T2.gender_code  =  "Female"