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: Which apartment type code is the most common among apartments with more than one bathroom?
SQL: SELECT apt_type_code FROM Apartments WHERE bathroom_count  >  1 GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1
-- 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 each apartment type code, and the maximum and minimum number of rooms for each type.
SQL: SELECT apt_type_code ,  max(room_count) ,  min(room_count) FROM Apartments GROUP BY apt_type_code
-- 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 along with the maximum and minimum number of rooms among each type.
SQL: SELECT apt_type_code ,  max(room_count) ,  min(room_count) FROM Apartments GROUP BY apt_type_code
-- 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 each gender code and the corresponding count of guests sorted by the count in descending order.
SQL: SELECT gender_code ,  COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
-- 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 gender codes in descending order of their corresponding number of guests. Return both the gender codes and counts.
SQL: SELECT gender_code ,  COUNT(*) FROM Guests GROUP BY gender_code ORDER BY COUNT(*) DESC
-- 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 apartments do not have any facility?
SQL: SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)
-- 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 number of apartments that have no facility.
SQL: SELECT count(*) FROM Apartments WHERE apt_id NOT IN (SELECT apt_id FROM Apartment_Facilities)
-- 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 of apartments with bookings that have status code both "Provisional" and "Confirmed"
SQL: SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Confirmed" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Provisional"
-- 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 both status codes "Provisional" and "Confirmed"? Give me the apartment numbers.
SQL: SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Confirmed" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id  =  T2.apt_id WHERE T1.booking_status_code  =  "Provisional"
-- 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 of apartments with unit status availability of both 0 and 1.
SQL: SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.available_yn  =  0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.available_yn  =  1
-- 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 unit status availability of both 0 and 1? Return their apartment numbers.
SQL: SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.available_yn  =  0 INTERSECT SELECT T1.apt_number FROM Apartments AS T1 JOIN View_Unit_Status AS T2 ON T1.apt_id  =  T2.apt_id WHERE T2.available_yn  =  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many games are held after season 2007?
SQL: SELECT count(*) FROM game WHERE season  >  2007
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the dates of games by the home team name in descending order.
SQL: SELECT Date FROM game ORDER BY home_team DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the season, home team, away team of all the games.
SQL: SELECT season ,  home_team ,  away_team FROM game
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the maximum, minimum and average home games each stadium held?
SQL: SELECT max(home_games) ,  min(home_games) ,  avg(home_games) FROM stadium
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the average attendance of stadiums with capacity percentage higher than 100%?
SQL: SELECT average_attendance FROM stadium WHERE capacity_percentage  >  100
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the player name, number of matches, and information source for players who do not suffer from injury of 'Knee problem'?
SQL: SELECT player ,  number_of_matches ,  SOURCE FROM injury_accident WHERE injury != 'Knee problem'
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the season of the game which causes the player 'Walter Samuel' to get injured?
SQL: SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id  =  T2.game_id WHERE T2.player  =  'Walter Samuel'
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the ids, scores, and dates of the games which caused at least two injury accidents?
SQL: SELECT T1.id ,  T1.score ,  T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id  =  T1.id GROUP BY T1.id HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the id and name of the stadium where the most injury accidents happened?
SQL: SELECT T1.id ,  T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id  =  T2.stadium_id JOIN injury_accident AS T3 ON T2.id  =  T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the id and name of the stadium where the largest number of injury accidents occurred.
SQL: SELECT T1.id ,  T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id  =  T2.stadium_id JOIN injury_accident AS T3 ON T2.id  =  T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?
SQL: SELECT T1.season ,  T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.id JOIN injury_accident AS T3 ON T1.id  =  T3.game_id WHERE T3.injury  =  'Foot injury' OR T3.injury  =  'Knee problem'
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many different kinds of information sources are there for injury accidents?
SQL: SELECT count(DISTINCT SOURCE) FROM injury_accident
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many games are free of injury accidents?
SQL: SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many distinct kinds of injuries happened after season 2010?
SQL: SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id  =  T2.id WHERE T2.season  >  2010
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.
SQL: SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.id JOIN injury_accident AS T3 ON T1.id  =  T3.game_id WHERE T3.player  =  'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.id JOIN injury_accident AS T3 ON T1.id  =  T3.game_id WHERE T3.player  =  'Thiago Motta'
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Show the name, average attendance, total attendance for stadiums where no accidents happened.
SQL: SELECT name ,  average_attendance ,  total_attendance FROM stadium EXCEPT SELECT T2.name ,  T2.average_attendance ,  T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id  =  T2.id JOIN injury_accident AS T3 ON T1.id  =  T3.game_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which stadium name contains the substring "Bank"?
SQL: SELECT name FROM stadium WHERE name LIKE "%Bank%"
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many games has each stadium held?
SQL: SELECT T1.id ,  count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id  =  T2.stadium_id GROUP BY T1.id
-- Language PostgreSQL
        -- Tables: 
             -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['home games', 'number'], ['average attendance', 'number'], ['total attendance', 'number'], ['capacity percentage', 'number']]

 -- Table: game 
columns : [['stadium id', 'number'], ['id', 'number'], ['season', 'number'], ['date', 'text'], ['home team', 'text'], ['away team', 'text'], ['score', 'text'], ['competition', 'text']]

 -- Table: injury accident 
columns : [['game id', 'number'], ['id', 'number'], ['player', 'text'], ['injury', 'text'], ['number of matches', 'text'], ['source', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.
SQL: SELECT T1.date ,  T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id  =  T2.game_id ORDER BY T1.season DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: player attributes 
columns : [['id', 'number'], ['player fifa api id', 'number'], ['player api id', 'number'], ['date', 'text'], ['overall rating', 'number'], ['potential', 'number'], ['preferred foot', 'text'], ['attacking work rate', 'text'], ['defensive work rate', 'text'], ['crossing', 'number'], ['finishing', 'number'], ['heading accuracy', 'number'], ['short passing', 'number'], ['volleys', 'number'], ['dribbling', 'number'], ['curve', 'number'], ['free kick accuracy', 'number'], ['long passing', 'number'], ['ball control', 'number'], ['acceleration', 'number'], ['sprint speed', 'number'], ['agility', 'number'], ['reactions', 'number'], ['balance', 'number'], ['shot power', 'number'], ['jumping', 'number'], ['stamina', 'number'], ['strength', 'number'], ['long shots', 'number'], ['aggression', 'number'], ['interceptions', 'number'], ['positioning', 'number'], ['vision', 'number'], ['penalties', 'number'], ['marking', 'number'], ['standing tackle', 'number'], ['sliding tackle', 'number'], ['gk diving', 'number'], ['gk handling', 'number'], ['gk kicking', 'number'], ['gk positioning', 'number'], ['gk reflexes', 'number']]

 -- Table: sqlite sequence 
columns : [['name', 'text'], ['seq', 'text']]

 -- Table: player 
columns : [['id', 'number'], ['player api id', 'number'], ['player name', 'text'], ['player fifa api id', 'number'], ['birthday', 'text'], ['height', 'number'], ['weight', 'number']]

 -- Table: league 
columns : [['id', 'number'], ['country id', 'number'], ['name', 'text']]

 -- Table: country 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: team 
columns : [['id', 'number'], ['team api id', 'number'], ['team fifa api id', 'number'], ['team long name', 'text'], ['team short name', 'text']]

 -- Table: team attributes 
columns : [['id', 'number'], ['team fifa api id', 'number'], ['team api id', 'number'], ['date', 'text'], ['buildup play speed', 'number'], ['buildup play speed class', 'text'], ['buildup play dribbling', 'number'], ['buildup play dribbling class', 'text'], ['buildup play passing', 'number'], ['buildup play passing class', 'text'], ['buildup play positioning class', 'text'], ['chance creation passing', 'number'], ['chance creation passing class', 'text'], ['chance creation crossing', 'number'], ['chance creation crossing class', 'text'], ['chance creation shooting', 'number'], ['chance creation shooting class', 'text'], ['chance creation positioning class', 'text'], ['defence pressure', 'number'], ['defence pressure class', 'text'], ['defence aggression', 'number'], ['defence aggression class', 'text'], ['defence team width', 'number'], ['defence team width class', 'text'], ['defence defender line class', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the average weight of all players?
SQL: SELECT avg(weight) FROM Player
-- Language PostgreSQL
        -- Tables: 
             -- Table: member 
columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']]

 -- Table: performance 
columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']]

 -- Table: member attendance 
columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']]

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 performances are there?
SQL: SELECT count(*) FROM performance
-- Language PostgreSQL
        -- Tables: 
             -- Table: member 
columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']]

 -- Table: performance 
columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']]

 -- Table: member attendance 
columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']]

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: List the hosts of performances in ascending order of attendance.
SQL: SELECT HOST FROM performance ORDER BY Attendance ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: member 
columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']]

 -- Table: performance 
columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']]

 -- Table: member attendance 
columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']]

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 dates and locations of performances?
SQL: SELECT Date ,  LOCATION FROM performance
-- Language PostgreSQL
        -- Tables: 
             -- Table: member 
columns : [['member id', 'text'], ['name', 'text'], ['nationality', 'text'], ['role', 'text']]

 -- Table: performance 
columns : [['performance id', 'number'], ['date', 'text'], ['host', 'text'], ['location', 'text'], ['attendance', 'number']]

 -- Table: member attendance 
columns : [['member id', 'number'], ['performance id', 'number'], ['num of pieces', 'number']]

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 attendances of the performances at location "TD Garden" or "Bell Centre"
SQL: SELECT Attendance FROM performance WHERE LOCATION  =  "TD Garden" OR LOCATION  =  "Bell Centre"