sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 average price and score of wines grouped by appelation?
SQL: SELECT avg(Price) ,  avg(Score) ,  Appelation FROM WINE GROUP BY Appelation
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 average price and score of wines for each appelation?
SQL: SELECT avg(Price) ,  avg(Score) ,  Appelation FROM WINE GROUP BY Appelation
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 wineries that have at least four wines.
SQL: SELECT Winery FROM WINE GROUP BY Winery HAVING count(*)  >=  4
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 wineries produce at least four wines?
SQL: SELECT Winery FROM WINE GROUP BY Winery HAVING count(*)  >=  4
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 country of all appelations who have at most three wines.
SQL: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING count(*)  <=  3
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 countries for appelations with at most 3 wines?
SQL: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation GROUP BY T2.Appelation HAVING count(*)  <=  3
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 names of wines whose production year are before the year of all wines by Brander winery?
SQL: SELECT Name FROM WINE WHERE YEAR  <  (SELECT min(YEAR) FROM WINE WHERE Winery  =  "Brander")
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 names of wines produced before any wine from the Brander winery?
SQL: SELECT Name FROM WINE WHERE YEAR  <  (SELECT min(YEAR) FROM WINE WHERE Winery  =  "Brander")
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 names of wines that are more expensive then all wines made in the year 2006?
SQL: SELECT Name FROM WINE WHERE Price  >  (SELECT max(Price) FROM WINE WHERE YEAR  =  2006)
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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: Give the names of wines with prices above any wine produced in 2006.
SQL: SELECT Name FROM WINE WHERE Price  >  (SELECT max(Price) FROM WINE WHERE YEAR  =  2006)
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 top 3 wineries with the greatest number of wines made of white color grapes.
SQL: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 3 wineries produce the most wines made from white grapes?
SQL: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE  =  T2.GRAPE WHERE T1.Color  =  "White" GROUP BY T2.Winery ORDER BY count(*) DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 grape, winery and year of the wines whose price is bigger than 100 ordered by year.
SQL: SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100 ORDER BY YEAR
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 grapes, wineries and years for wines with price higher than 100, sorted by year?
SQL: SELECT Grape ,  Winery ,  YEAR FROM WINE WHERE Price  >   100 ORDER BY YEAR
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 grape, appelation and name of wines whose score is higher than 93 ordered by Name.
SQL: SELECT Grape ,  Appelation ,  Name FROM WINE WHERE Score  >  93 ORDER BY Name
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 grapes, appelations, and wines with scores above 93, sorted by Name?
SQL: SELECT Grape ,  Appelation ,  Name FROM WINE WHERE Score  >  93 ORDER BY Name
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 appelations that produce wines after the year of 2008 but not in Central Coast area.
SQL: SELECT Appelation FROM WINE WHERE YEAR  >  2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area  =  "Central Coast"
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 appelations for wines produced after 2008 but not in the Central Coast area?
SQL: SELECT Appelation FROM WINE WHERE YEAR  >  2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area  =  "Central Coast"
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 average price of wines that are not produced from Sonoma county.
SQL: SELECT avg(price) FROM wine WHERE Appelation NOT IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  'Sonoma')
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 price for wines not produced in Sonoma county?
SQL: SELECT avg(price) FROM wine WHERE Appelation NOT IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T1.County  =  'Sonoma')
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 county where produces the most number of wines with score higher than 90.
SQL: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T2.Score  >  90 GROUP BY T1.County ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: grapes 
columns : [['id', 'number'], ['grape', 'text'], ['color', 'text']]

 -- Table: appellations 
columns : [['no', 'number'], ['appelation', 'text'], ['county', 'text'], ['state', 'text'], ['area', 'text'], ['isava', 'text']]

 -- Table: wine 
columns : [['no', 'number'], ['grape', 'text'], ['winery', 'text'], ['appelation', 'text'], ['state', 'text'], ['name', 'text'], ['year', 'number'], ['price', 'number'], ['score', 'number'], ['cases', 'number'], ['drink', '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 county that produces the most wines scoring higher than 90?
SQL: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation  =  T2.Appelation WHERE T2.Score  >  90 GROUP BY T1.County ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 train stations are there?
SQL: SELECT count(*) FROM station
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 name, location, and number of platforms for all stations.
SQL: SELECT name ,  LOCATION ,  number_of_platforms FROM station
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 all locations of train stations?
SQL: SELECT DISTINCT LOCATION FROM station
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 names and total passengers for all train stations not in London.
SQL: SELECT name ,  total_passengers FROM station WHERE LOCATION != 'London'
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 names and main services for train stations that have the top three total number of passengers.
SQL: SELECT name ,  main_services FROM station ORDER BY total_passengers DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 is the average and maximum number of total passengers for train stations in London or Glasgow?
SQL: SELECT avg(total_passengers) ,  max(total_passengers) FROM station WHERE LOCATION  =  'London' OR LOCATION  =  'Glasgow'
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 all locations and the total number of platforms and passengers for all train stations in each location.
SQL: SELECT LOCATION ,  sum(number_of_platforms) ,  sum(total_passengers) FROM station GROUP BY LOCATION
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
SQL: SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms  >=  15 AND total_passengers  >  25
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 all locations which don't have a train station with at least 15 platforms.
SQL: SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms  >=  15
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 location with most number of train stations.
SQL: SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 name, time, and service for all trains.
SQL: SELECT name ,  TIME ,  service FROM train
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 number of trains
SQL: SELECT count(*) FROM train
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 name and service for all trains in order by time.
SQL: SELECT name ,  service FROM train ORDER BY TIME
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 station name and number of trains in each station.
SQL: SELECT T2.name ,  count(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id GROUP BY T1.station_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 train name and station name for each train.
SQL: SELECT T2.name ,  T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id JOIN train AS T3 ON T3.train_id  =  T1.train_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 all train names and times in stations in London in descending order by train time.
SQL: SELECT T3.name ,  T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id JOIN train AS T3 ON T3.train_id  =  T1.train_id WHERE T2.location  =  'London' ORDER BY T3.time DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 station name with greatest number of trains.
SQL: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id GROUP BY T1.station_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 station name with at least two trains.
SQL: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id GROUP BY T1.station_id HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 all locations with only 1 station.
SQL: SELECT LOCATION FROM station GROUP BY LOCATION HAVING count(*)  =  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 station names without any trains.
SQL: SELECT name FROM station WHERE station_id NOT IN (SELECT station_id FROM train_station)
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 names of the stations which serve both "Ananthapuri Express" and "Guruvayur Express" trains?
SQL: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id JOIN train AS T3 ON T3.train_id  =  T1.train_id WHERE T3.Name  =  "Ananthapuri Express" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id  =  T2.station_id JOIN train AS T3 ON T3.train_id  =  T1.train_id WHERE T3.Name  =  "Guruvayur Express"
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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: Find the names of the trains that do not pass any station located in London.
SQL: SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id  =  T2.train_id WHERE T1.station_id NOT IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id  =  T4.station_id WHERE t4.location  =  "London")
-- Language PostgreSQL
        -- Tables: 
             -- Table: station 
columns : [['station id', 'number'], ['name', 'text'], ['annual entry exit', 'number'], ['annual interchanges', 'number'], ['total passengers', 'number'], ['location', 'text'], ['main services', 'text'], ['number of platforms', 'number']]

 -- Table: train 
columns : [['train id', 'number'], ['name', 'text'], ['time', 'text'], ['service', 'text']]

 -- Table: train station 
columns : [['train id', 'number'], ['station id', '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 names and locations of all stations ordered by their yearly entry exit and interchange amounts.
SQL: SELECT name ,  LOCATION FROM station ORDER BY Annual_entry_exit ,  Annual_interchanges
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]

 -- Table: staff 
columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']]

 -- Table: vehicles 
columns : [['vehicle id', 'number'], ['vehicle details', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']]

 -- Table: customer payments 
columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']]

 -- Table: lessons 
columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 all vehicle id
SQL: SELECT vehicle_id FROM Vehicles;