brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
What are the numbers of the shortest flights?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the numbers of the shortest flights?` to a syntactically-correct PostgreSQL query.
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
What is the average distance and average price for flights from Los Angeles.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the average distance and average price for flights from Los Angeles.` to a syntactically-correct PostgreSQL query.
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles"
What is the average distance and price for all flights from LA?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the average distance and price for all flights from LA?` to a syntactically-correct PostgreSQL query.
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles"
Show all origins and the number of flights from each origin.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show all origins and the number of flights from each origin.` to a syntactically-correct PostgreSQL query.
SELECT origin , count(*) FROM Flight GROUP BY origin
For each origin, how many flights came from there?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `For each origin, how many flights came from there?` to a syntactically-correct PostgreSQL query.
SELECT origin , count(*) FROM Flight GROUP BY origin
Show all destinations and the number of flights to each destination.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show all destinations and the number of flights to each destination.` to a syntactically-correct PostgreSQL query.
SELECT destination , count(*) FROM Flight GROUP BY destination
What are the destinations and number of flights to each one?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the destinations and number of flights to each one?` to a syntactically-correct PostgreSQL query.
SELECT destination , count(*) FROM Flight GROUP BY destination
Which origin has most number of flights?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Which origin has most number of flights?` to a syntactically-correct PostgreSQL query.
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
What place has the most flights coming from there?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What place has the most flights coming from there?` to a syntactically-correct PostgreSQL query.
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
Which destination has least number of flights?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Which destination has least number of flights?` to a syntactically-correct PostgreSQL query.
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
What destination has the fewest number of flights?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What destination has the fewest number of flights?` to a syntactically-correct PostgreSQL query.
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
What is the aircraft name for the flight with number 99
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the aircraft name for the flight with number 99` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99
What is the name of the aircraft that was on flight number 99?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the name of the aircraft that was on flight number 99?` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99
Show all flight numbers with aircraft Airbus A340-300.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show all flight numbers with aircraft Airbus A340-300.` to a syntactically-correct PostgreSQL query.
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300"
What are the flight numbers for the aircraft Airbus A340-300?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the flight numbers for the aircraft Airbus A340-300?` to a syntactically-correct PostgreSQL query.
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300"
Show aircraft names and number of flights for each aircraft.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show aircraft names and number of flights for each aircraft.` to a syntactically-correct PostgreSQL query.
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid
What is the name of each aircraft and how many flights does each one complete?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the name of each aircraft and how many flights does each one complete?` to a syntactically-correct PostgreSQL query.
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid
Show names for all aircraft with at least two flights.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show names for all aircraft with at least two flights.` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2
What are the names for all aircrafts with at least 2 flights?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the names for all aircrafts with at least 2 flights?` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2
How many employees have certificate.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `How many employees have certificate.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT eid) FROM Certificate
What is the count of distinct employees with certificates?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the count of distinct employees with certificates?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT eid) FROM Certificate
Show ids for all employees who don't have a certificate.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show ids for all employees who don't have a certificate.` to a syntactically-correct PostgreSQL query.
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
What are the ids of all employees that don't have certificates?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the ids of all employees that don't have certificates?` to a syntactically-correct PostgreSQL query.
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
Show names for all aircrafts of which John Williams has certificates.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show names for all aircrafts of which John Williams has certificates.` to a syntactically-correct PostgreSQL query.
SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = "John Williams"
What are the names of all aircrafts that John Williams have certificates to be able to fly?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the names of all aircrafts that John Williams have certificates to be able to fly?` to a syntactically-correct PostgreSQL query.
SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = "John Williams"
Show names for all employees who have certificate of Boeing 737-800.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show names for all employees who have certificate of Boeing 737-800.` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800"
What are the names of all employees who have a certificate to fly Boeing 737-800?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the names of all employees who have a certificate to fly Boeing 737-800?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800"
Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800" INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Airbus A340-300"
What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800" INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Airbus A340-300"
Show names for all employees who do not have certificate of Boeing 737-800.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show names for all employees who do not have certificate of Boeing 737-800.` to a syntactically-correct PostgreSQL query.
SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800"
What are the names of all employees who are not certified to fly Boeing 737-800s?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the names of all employees who are not certified to fly Boeing 737-800s?` to a syntactically-correct PostgreSQL query.
SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800"
Show the name of aircraft which fewest people have its certificate.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show the name of aircraft which fewest people have its certificate.` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY count(*) DESC LIMIT 1
What are the names of the aircraft that the least people are certified to fly?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What are the names of the aircraft that the least people are certified to fly?` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY count(*) DESC LIMIT 1
Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY count(*) >= 5
What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY count(*) >= 5
what is the salary and name of the employee who has the most number of aircraft certificates?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `what is the salary and name of the employee who has the most number of aircraft certificates?` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1
What is the salaray and name of the employee that is certified to fly the most planes?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the salaray and name of the employee that is certified to fly the most planes?` to a syntactically-correct PostgreSQL query.
SELECT T1.name , T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1
What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1
What is the salaray and name of the employee with the most certificates to fly planes more than 5000?
-- Language PostgreSQL -- Tables: -- Table: flight columns : [['flight number', 'number'], ['origin', 'text'], ['destination', 'text'], ['distance', 'number'], ['departure date', 'time'], ['arrival date', 'time'], ['price', 'number'], ['airline id', 'number']] -- Table: aircraft columns : [['airline id', 'number'], ['name', 'text'], ['distance', 'number']] -- Table: employee columns : [['employee id', 'number'], ['name', 'text'], ['salary', 'number']] -- Table: certificate columns : [['employee id', 'number'], ['airline 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. Translate `What is the salaray and name of the employee with the most certificates to fly planes more than 5000?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1
How many allergies are there?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many allergies are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT allergy) FROM Allergy_type
How many allergy entries are there?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many allergy entries are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT allergy) FROM Allergy_type
How many different allergy types exist?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many different allergy types exist?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT allergytype) FROM Allergy_type
How many distinct allergies are there?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many distinct allergies are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT allergytype) FROM Allergy_type
Show all allergy types.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all allergy types.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT allergytype FROM Allergy_type
What are the different allergy types?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the different allergy types?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT allergytype FROM Allergy_type
Show all allergies and their types.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all allergies and their types.` to a syntactically-correct PostgreSQL query.
SELECT allergy , allergytype FROM Allergy_type
What are the allergies and their types?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the allergies and their types?` to a syntactically-correct PostgreSQL query.
SELECT allergy , allergytype FROM Allergy_type
Show all allergies with type food.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all allergies with type food.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food"
What are all the different food allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are all the different food allergies?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food"
What is the type of allergy Cat?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What is the type of allergy Cat?` to a syntactically-correct PostgreSQL query.
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
What is allergy type of a cat allergy?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What is allergy type of a cat allergy?` to a syntactically-correct PostgreSQL query.
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
How many allergies have type animal?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many allergies have type animal?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal"
How many animal type allergies exist?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many animal type allergies exist?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal"
Show all allergy types and the number of allergies in each type.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all allergy types and the number of allergies in each type.` to a syntactically-correct PostgreSQL query.
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype
What are the allergy types and how many allergies correspond to each one?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the allergy types and how many allergies correspond to each one?` to a syntactically-correct PostgreSQL query.
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype
Which allergy type has most number of allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Which allergy type has most number of allergies?` to a syntactically-correct PostgreSQL query.
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
Which allergy type is most common?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Which allergy type is most common?` to a syntactically-correct PostgreSQL query.
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
Which allergy type has least number of allergies?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Which allergy type has least number of allergies?` to a syntactically-correct PostgreSQL query.
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
Which allergy type is the least common?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Which allergy type is the least common?` to a syntactically-correct PostgreSQL query.
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
How many students are there?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many students are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Student
What is the total number of students?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What is the total number of students?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Student
Show first name and last name for all students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show first name and last name for all students.` to a syntactically-correct PostgreSQL query.
SELECT Fname , Lname FROM Student
What are the full names of all students
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the full names of all students` to a syntactically-correct PostgreSQL query.
SELECT Fname , Lname FROM Student
How many different advisors are listed?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many different advisors are listed?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT advisor) FROM Student
How many advisors are there?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many advisors are there?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT advisor) FROM Student
Show all majors.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all majors.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT Major FROM Student
What are the different majors?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the different majors?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT Major FROM Student
Show all cities where students live.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all cities where students live.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT city_code FROM Student
What cities do students live in?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What cities do students live in?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT city_code FROM Student
Show first name, last name, age for all female students. Their sex is F.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show first name, last name, age for all female students. Their sex is F.` to a syntactically-correct PostgreSQL query.
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'
What are the full names and ages for all female students whose sex is F?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the full names and ages for all female students whose sex is F?` to a syntactically-correct PostgreSQL query.
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'
Show student ids for all male students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show student ids for all male students.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE Sex = 'M'
What are the student ids for all male students?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the student ids for all male students?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE Sex = 'M'
How many students are age 18?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many students are age 18?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Student WHERE age = 18
How many students are 18 years old?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many students are 18 years old?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Student WHERE age = 18
Show all student ids who are older than 20.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all student ids who are older than 20.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE age > 20
What are the student ids for students over 20 years old?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the student ids for students over 20 years old?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE age > 20
Which city does the student whose last name is "Kim" live in?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Which city does the student whose last name is "Kim" live in?` to a syntactically-correct PostgreSQL query.
SELECT city_code FROM Student WHERE LName = "Kim"
Give the city that the student whose family name is Kim lives in.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Give the city that the student whose family name is Kim lives in.` to a syntactically-correct PostgreSQL query.
SELECT city_code FROM Student WHERE LName = "Kim"
Who is the advisor of student with ID 1004?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Who is the advisor of student with ID 1004?` to a syntactically-correct PostgreSQL query.
SELECT Advisor FROM Student WHERE StuID = 1004
Who advises student 1004?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Who advises student 1004?` to a syntactically-correct PostgreSQL query.
SELECT Advisor FROM Student WHERE StuID = 1004
How many students live in HKG or CHI?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many students live in HKG or CHI?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI"
Give the number of students living in either HKG or CHI.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Give the number of students living in either HKG or CHI.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI"
Show the minimum, average, and maximum age of all students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show the minimum, average, and maximum age of all students.` to a syntactically-correct PostgreSQL query.
SELECT min(age) , avg(age) , max(age) FROM Student
What is the minimum, mean, and maximum age across all students?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What is the minimum, mean, and maximum age across all students?` to a syntactically-correct PostgreSQL query.
SELECT min(age) , avg(age) , max(age) FROM Student
What is the last name of the youngest student?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What is the last name of the youngest student?` to a syntactically-correct PostgreSQL query.
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
Provide the last name of the youngest student.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Provide the last name of the youngest student.` to a syntactically-correct PostgreSQL query.
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
Show the student id of the oldest student.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show the student id of the oldest student.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)
What student id corresponds to the oldest student?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What student id corresponds to the oldest student?` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)
Show all majors and corresponding number of students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all majors and corresponding number of students.` to a syntactically-correct PostgreSQL query.
SELECT major , count(*) FROM Student GROUP BY major
How many students are there for each major?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many students are there for each major?` to a syntactically-correct PostgreSQL query.
SELECT major , count(*) FROM Student GROUP BY major
Which major has most number of students?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Which major has most number of students?` to a syntactically-correct PostgreSQL query.
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
What is the largest major?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What is the largest major?` to a syntactically-correct PostgreSQL query.
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
Show all ages and corresponding number of students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all ages and corresponding number of students.` to a syntactically-correct PostgreSQL query.
SELECT age , count(*) FROM Student GROUP BY age
How old is each student and how many students are each age?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How old is each student and how many students are each age?` to a syntactically-correct PostgreSQL query.
SELECT age , count(*) FROM Student GROUP BY age
Show the average age for male and female students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show the average age for male and female students.` to a syntactically-correct PostgreSQL query.
SELECT avg(age) , sex FROM Student GROUP BY sex
What are the average ages for male and female students?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `What are the average ages for male and female students?` to a syntactically-correct PostgreSQL query.
SELECT avg(age) , sex FROM Student GROUP BY sex
Show all cities and corresponding number of students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all cities and corresponding number of students.` to a syntactically-correct PostgreSQL query.
SELECT city_code , count(*) FROM Student GROUP BY city_code
How many students live in each city?
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `How many students live in each city?` to a syntactically-correct PostgreSQL query.
SELECT city_code , count(*) FROM Student GROUP BY city_code
Show all advisors and corresponding number of students.
-- Language PostgreSQL -- Tables: -- Table: allergy type columns : [['allergy name', 'text'], ['allergy type', 'text']] -- Table: has allergy columns : [['stuid', 'number'], ['allergy', 'text']] -- Table: student columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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. Translate `Show all advisors and corresponding number of students.` to a syntactically-correct PostgreSQL query.
SELECT advisor , count(*) FROM Student GROUP BY advisor