sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 name of the stadium which held the most events?
SQL: SELECT t1.name FROM stadium AS t1 JOIN event AS t2 ON t1.id  =  t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 name and capacity of the stadium where the event named "World Junior" happened.
SQL: SELECT t1.name ,  t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id  =  t2.stadium_id WHERE t2.name  =  'World Junior'
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 stadiums which have never had any event.
SQL: SELECT name FROM stadium WHERE id NOT IN (SELECT stadium_id FROM event)
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 name of the swimmer who has the most records.
SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 name of the swimmer who has at least 2 records.
SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id GROUP BY t2.swimmer_id HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time.
SQL: SELECT t1.name ,  t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  'Win' GROUP BY t2.swimmer_id HAVING count(*)  >  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 swimmers who have no record.
SQL: SELECT name FROM swimmer WHERE id NOT IN (SELECT swimmer_id FROM record)
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 swimmers who have both "win" and "loss" results in the record.
SQL: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  'Win' INTERSECT SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id WHERE RESULT  =  'Loss'
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 stadiums that some Australian swimmers have been to.
SQL: SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id  =  t2.swimmer_id JOIN event AS t3 ON t2.event_id  =  t3.id JOIN stadium AS t4 ON t4.id  =  t3.stadium_id WHERE t1.nationality  =  'Australia'
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 stadiums that the most swimmers have been to.
SQL: SELECT t3.name FROM record AS t1 JOIN event AS t2 ON t1.event_id  =  t2.id JOIN stadium AS t3 ON t3.id  =  t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 all details for each swimmer.
SQL: SELECT * FROM swimmer
-- Language PostgreSQL
        -- Tables: 
             -- Table: swimmer 
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]

 -- Table: stadium 
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]

 -- Table: event 
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]

 -- Table: record 
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event 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 capacity of the stadiums that were opened in year 2005?
SQL: SELECT avg(capacity) FROM stadium WHERE opening_year  =  2005
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 railways are there?
SQL: SELECT count(*) FROM railway
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 builders of railways in ascending alphabetical order.
SQL: SELECT Builder FROM railway ORDER BY Builder ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 wheels and locations of the railways.
SQL: SELECT Wheels ,  LOCATION FROM railway
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 maximum level of managers in countries that are not "Australia"?
SQL: SELECT max(LEVEL) FROM manager WHERE Country != "Australia	"
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 age for all managers?
SQL: SELECT avg(Age) FROM manager
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 managers in ascending order of level?
SQL: SELECT Name FROM manager ORDER BY LEVEL ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 and arrival times of trains?
SQL: SELECT Name ,  Arrival FROM train
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 name of the oldest manager?
SQL: SELECT Name FROM manager ORDER BY Age DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 names of trains and locations of railways they are in.
SQL: SELECT T2.Name ,  T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 builder of railways associated with the trains named "Andaman Exp".
SQL: SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID WHERE T2.Name  =  "Andaman Exp"
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 id and location of railways that are associated with more than one train.
SQL: SELECT T2.Railway_ID ,  T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*)  >  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 id and builder of the railway that are associated with the most trains.
SQL: SELECT T2.Railway_ID ,  T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID  =  T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 different builders of railways, along with the corresponding number of railways using each builder.
SQL: SELECT Builder ,  COUNT(*) FROM railway GROUP BY Builder
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 most common builder of railways.
SQL: SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 different locations of railways along with the corresponding number of railways at each location.
SQL: SELECT LOCATION ,  COUNT(*) FROM railway GROUP BY LOCATION
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 locations that have more than one railways.
SQL: SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*)  >  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 object number of railways that do not have any trains.
SQL: SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN (SELECT Railway_ID FROM train)
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 countries that have both managers of age above 50 and managers of age below 46.
SQL: SELECT Country FROM manager WHERE Age  >  50 INTERSECT SELECT Country FROM manager WHERE Age  <  46
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 distinct countries of managers.
SQL: SELECT DISTINCT Country FROM manager
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 working years of managers in descending order of their level.
SQL: SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: railway 
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]

 -- Table: train 
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]

 -- Table: manager 
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]

 -- Table: railway manage 
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', '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 countries that have managers of age above 50 or below 46.
SQL: SELECT Country FROM manager WHERE Age  >  50 OR Age  <  46
-- 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: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]

 -- Table: contacts 
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]

 -- Table: customer address history 
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', '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 addresses are there in country USA?
SQL: SELECT count(*) FROM addresses WHERE country  =  'USA'
-- 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: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]

 -- Table: contacts 
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]

 -- Table: customer address history 
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', '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 all distinct cities in the address record.
SQL: SELECT DISTINCT city FROM addresses
-- 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: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]

 -- Table: contacts 
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]

 -- Table: customer address history 
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', '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 each state and the number of addresses in each state.
SQL: SELECT state_province_county ,  count(*) FROM addresses GROUP BY state_province_county
-- 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: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]

 -- Table: contacts 
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]

 -- Table: customer address history 
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', '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 names and phones of customers who do not have address information.
SQL: SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history)
-- 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: products 
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]

 -- Table: contacts 
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]

 -- Table: customer address history 
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', '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 of the customer who has the most orders.
SQL: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1