brief_instruction
stringlengths 16
224
| instruction
stringlengths 687
8.77k
| output
stringlengths 18
577
|
---|---|---|
How many colors are never used by any product? |
-- Language PostgreSQL
-- Tables:
-- Table: reference characteristic types
columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']]
-- Table: reference colors
columns : [['color code', 'text'], ['color description', 'text']]
-- Table: reference product categories
columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']]
-- Table: characteristics
columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']]
-- Table: product characteristics
columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', '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 colors are never used by any product?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products ) |
Count the number of colors that are not used in any products. |
-- Language PostgreSQL
-- Tables:
-- Table: reference characteristic types
columns : [['characteristic type code', 'text'], ['characteristic type description', 'text']]
-- Table: reference colors
columns : [['color code', 'text'], ['color description', 'text']]
-- Table: reference product categories
columns : [['product category code', 'text'], ['product category description', 'text'], ['unit of measure', 'text']]
-- Table: characteristics
columns : [['characteristic id', 'number'], ['characteristic type code', 'text'], ['characteristic data type', 'text'], ['characteristic name', 'text'], ['other characteristic details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['color code', 'text'], ['product category code', 'text'], ['product name', 'text'], ['typical buying price', 'text'], ['typical selling price', 'text'], ['product description', 'text'], ['other product details', 'text']]
-- Table: product characteristics
columns : [['product id', 'number'], ['characteristic id', 'number'], ['product characteristic value', '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 `Count the number of colors that are not used in any products.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products ) |
How many events are there? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many events are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM event |
List all the event names by year from the most recent to the oldest. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List all the event names by year from the most recent to the oldest.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM event ORDER BY YEAR DESC |
What is the name of the event that happened in the most recent year? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the event that happened in the most recent year?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM event ORDER BY YEAR DESC LIMIT 1 |
How many stadiums are there? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many stadiums are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM stadium |
Find the name of the stadium that has the maximum capacity. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the stadium that has the maximum capacity.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1 |
Find the names of stadiums whose capacity is smaller than the average capacity. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of stadiums whose capacity is smaller than the average capacity.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM stadium WHERE capacity < (SELECT avg(capacity) FROM stadium) |
Find the country that has the most stadiums. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the country that has the most stadiums.` to a syntactically-correct PostgreSQL query.
| SELECT country FROM stadium GROUP BY country ORDER BY count(*) DESC LIMIT 1 |
Which country has at most 3 stadiums listed? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which country has at most 3 stadiums listed?` to a syntactically-correct PostgreSQL query.
| SELECT country FROM stadium GROUP BY country HAVING count(*) <= 3 |
Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000?` to a syntactically-correct PostgreSQL query.
| SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000 |
How many cities have a stadium that was opened before the year of 2006? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many cities have a stadium that was opened before the year of 2006?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT city) FROM stadium WHERE opening_year < 2006 |
How many stadiums does each country have? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many stadiums does each country have?` to a syntactically-correct PostgreSQL query.
| SELECT country , count(*) FROM stadium GROUP BY country |
Which countries do not have a stadium that was opened after 2006? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which countries do not have a stadium that was opened after 2006?` to a syntactically-correct PostgreSQL query.
| SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006 |
How many stadiums are not in country "Russia"? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many stadiums are not in country "Russia"?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM stadium WHERE country != 'Russia' |
Find the names of all swimmers, sorted by their 100 meter scores in ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of all swimmers, sorted by their 100 meter scores in ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM swimmer ORDER BY meter_100 |
How many different countries are all the swimmers from? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many different countries are all the swimmers from?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT nationality) FROM swimmer |
List countries that have more than one swimmer. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List countries that have more than one swimmer.` to a syntactically-correct PostgreSQL query.
| SELECT nationality , count(*) FROM swimmer GROUP BY nationality HAVING count(*) > 1 |
Find all 200 meter and 300 meter results of swimmers with nationality "Australia". |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find all 200 meter and 300 meter results of swimmers with nationality "Australia".` to a syntactically-correct PostgreSQL query.
| SELECT meter_200 , meter_300 FROM swimmer WHERE nationality = 'Australia' |
Find the names of swimmers who has a result of "win". |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of swimmers who has a result of "win".` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' |
What is the name of the stadium which held the most events? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the stadium which held the most events?` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1 |
Find the name and capacity of the stadium where the event named "World Junior" happened. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and capacity of the stadium where the event named "World Junior" happened.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name , t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior' |
Find the names of stadiums which have never had any event. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of stadiums which have never had any event.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM stadium WHERE id NOT IN (SELECT stadium_id FROM event) |
Find the name of the swimmer who has the most records. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the swimmer who has the most records.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY count(*) DESC LIMIT 1 |
Find the name of the swimmer who has at least 2 records. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the swimmer who has at least 2 records.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id HAVING count(*) >= 2 |
Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name , t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' GROUP BY t2.swimmer_id HAVING count(*) > 1 |
Find the names of the swimmers who have no record. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of the swimmers who have no record.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM swimmer WHERE id NOT IN (SELECT swimmer_id FROM record) |
Find the names of the swimmers who have both "win" and "loss" results in the record. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of the swimmers who have both "win" and "loss" results in the record.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' INTERSECT SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Loss' |
Find the names of stadiums that some Australian swimmers have been to. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of stadiums that some Australian swimmers have been to.` to a syntactically-correct PostgreSQL query.
| SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id JOIN event AS t3 ON t2.event_id = t3.id JOIN stadium AS t4 ON t4.id = t3.stadium_id WHERE t1.nationality = 'Australia' |
Find the names of stadiums that the most swimmers have been to. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of stadiums that the most swimmers have been to.` to a syntactically-correct PostgreSQL query.
| SELECT t3.name FROM record AS t1 JOIN event AS t2 ON t1.event_id = t2.id JOIN stadium AS t3 ON t3.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1 |
Find all details for each swimmer. |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find all details for each swimmer.` to a syntactically-correct PostgreSQL query.
| SELECT * FROM swimmer |
What is the average capacity of the stadiums that were opened in year 2005? |
-- Language PostgreSQL
-- Tables:
-- Table: swimmer
columns : [['id', 'number'], ['name', 'text'], ['nationality', 'text'], ['meter 100', 'number'], ['meter 200', 'text'], ['meter 300', 'text'], ['meter 400', 'text'], ['meter 500', 'text'], ['meter 600', 'text'], ['meter 700', 'text'], ['time', 'text']]
-- Table: stadium
columns : [['id', 'number'], ['name', 'text'], ['capacity', 'number'], ['city', 'text'], ['country', 'text'], ['opening year', 'number']]
-- Table: event
columns : [['id', 'number'], ['name', 'text'], ['stadium id', 'number'], ['year', 'text']]
-- Table: record
columns : [['id', 'number'], ['result', 'text'], ['swimmer id', 'number'], ['event id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average capacity of the stadiums that were opened in year 2005?` to a syntactically-correct PostgreSQL query.
| SELECT avg(capacity) FROM stadium WHERE opening_year = 2005 |
How many railways are there? |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many railways are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM railway |
List the builders of railways in ascending alphabetical order. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the builders of railways in ascending alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT Builder FROM railway ORDER BY Builder ASC |
List the wheels and locations of the railways. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the wheels and locations of the railways.` to a syntactically-correct PostgreSQL query.
| SELECT Wheels , LOCATION FROM railway |
What is the maximum level of managers in countries that are not "Australia"? |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the maximum level of managers in countries that are not "Australia"?` to a syntactically-correct PostgreSQL query.
| SELECT max(LEVEL) FROM manager WHERE Country != "Australia " |
What is the average age for all managers? |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average age for all managers?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Age) FROM manager |
What are the names of managers in ascending order of level? |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of managers in ascending order of level?` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM manager ORDER BY LEVEL ASC |
What are the names and arrival times of trains? |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names and arrival times of trains?` to a syntactically-correct PostgreSQL query.
| SELECT Name , Arrival FROM train |
What is the name of the oldest manager? |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the oldest manager?` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM manager ORDER BY Age DESC LIMIT 1 |
Show the names of trains and locations of railways they are in. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the names of trains and locations of railways they are in.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Name , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID |
Show the builder of railways associated with the trains named "Andaman Exp". |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the builder of railways associated with the trains named "Andaman Exp".` to a syntactically-correct PostgreSQL query.
| SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp" |
Show id and location of railways that are associated with more than one train. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show id and location of railways that are associated with more than one train.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Railway_ID , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1 |
Show the id and builder of the railway that are associated with the most trains. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the id and builder of the railway that are associated with the most trains.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Railway_ID , T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1 |
Show different builders of railways, along with the corresponding number of railways using each builder. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show different builders of railways, along with the corresponding number of railways using each builder.` to a syntactically-correct PostgreSQL query.
| SELECT Builder , COUNT(*) FROM railway GROUP BY Builder |
Show the most common builder of railways. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the most common builder of railways.` to a syntactically-correct PostgreSQL query.
| SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1 |
Show different locations of railways along with the corresponding number of railways at each location. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show different locations of railways along with the corresponding number of railways at each location.` to a syntactically-correct PostgreSQL query.
| SELECT LOCATION , COUNT(*) FROM railway GROUP BY LOCATION |
Show the locations that have more than one railways. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the locations that have more than one railways.` to a syntactically-correct PostgreSQL query.
| SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1 |
List the object number of railways that do not have any trains. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the object number of railways that do not have any trains.` to a syntactically-correct PostgreSQL query.
| SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN (SELECT Railway_ID FROM train) |
Show the countries that have both managers of age above 50 and managers of age below 46. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the countries that have both managers of age above 50 and managers of age below 46.` to a syntactically-correct PostgreSQL query.
| SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46 |
Show the distinct countries of managers. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the distinct countries of managers.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Country FROM manager |
Show the working years of managers in descending order of their level. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the working years of managers in descending order of their level.` to a syntactically-correct PostgreSQL query.
| SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC |
Show the countries that have managers of age above 50 or below 46. |
-- Language PostgreSQL
-- Tables:
-- Table: railway
columns : [['railway id', 'number'], ['railway', 'text'], ['builder', 'text'], ['built', 'text'], ['wheels', 'text'], ['location', 'text'], ['objectnumber', 'text']]
-- Table: train
columns : [['train id', 'number'], ['train num', 'text'], ['name', 'text'], ['from', 'text'], ['arrival', 'text'], ['railway id', 'number']]
-- Table: manager
columns : [['manager id', 'number'], ['name', 'text'], ['country', 'text'], ['working year starts', 'text'], ['age', 'number'], ['level', 'number']]
-- Table: railway manage
columns : [['railway id', 'number'], ['manager id', 'number'], ['from year', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the countries that have managers of age above 50 or below 46.` to a syntactically-correct PostgreSQL query.
| SELECT Country FROM manager WHERE Age > 50 OR Age < 46 |
How many addresses are there in country USA? |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many addresses are there in country USA?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM addresses WHERE country = 'USA' |
Show all distinct cities in the address record. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all distinct cities in the address record.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT city FROM addresses |
Show each state and the number of addresses in each state. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show each state and the number of addresses in each state.` to a syntactically-correct PostgreSQL query.
| SELECT state_province_county , count(*) FROM addresses GROUP BY state_province_county |
Show names and phones of customers who do not have address information. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show names and phones of customers who do not have address information.` to a syntactically-correct PostgreSQL query.
| SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history) |
Show the name of the customer who has the most orders. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of the customer who has the most orders.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1 |
Show the product type codes which have at least two products. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the product type codes which have at least two products.` to a syntactically-correct PostgreSQL query.
| SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*) >= 2 |
Show the names of customers who have both an order in completed status and an order in part status. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the names of customers who have both an order in completed status and an order in part status.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part' |
Show the name, phone, and payment method code for all customers in descending order of customer number. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name, phone, and payment method code for all customers in descending order of customer number.` to a syntactically-correct PostgreSQL query.
| SELECT customer_name , customer_phone , payment_method_code FROM customers ORDER BY customer_number DESC |
Show the product name and total order quantity for each product. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the product name and total order quantity for each product.` to a syntactically-correct PostgreSQL query.
| SELECT T1.product_name , sum(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id |
Show the minimum, maximum, average price for all products. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the minimum, maximum, average price for all products.` to a syntactically-correct PostgreSQL query.
| SELECT min(product_price) , max(product_price) , avg(product_price) FROM products |
How many products have a price higher than the average? |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many products have a price higher than the average?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM products WHERE product_price > (SELECT avg(product_price) FROM products) |
Show the customer name, customer address city, date from, and date to for each customer address history. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the customer name, customer address city, date from, and date to for each customer address history.` to a syntactically-correct PostgreSQL query.
| SELECT T2.customer_name , T3.city , T1.date_from , T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id |
Show the names of customers who use Credit Card payment method and have more than 2 orders. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the names of customers who use Credit Card payment method and have more than 2 orders.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING count(*) > 2 |
What are the name and phone of the customer with the most ordered product quantity? |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the name and phone of the customer with the most ordered product quantity?` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC LIMIT 1 |
Show the product type and name for the products with price higher than 1000 or lower than 500. |
-- Language PostgreSQL
-- Tables:
-- Table: addresses
columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product type code', 'text'], ['product name', 'text'], ['product price', 'number']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method code', 'text'], ['customer number', 'text'], ['customer name', 'text'], ['customer address', 'text'], ['customer phone', 'text'], ['customer email', 'text']]
-- Table: contacts
columns : [['contact id', 'number'], ['customer id', 'number'], ['gender', 'text'], ['first name', 'text'], ['last name', 'text'], ['contact phone', 'text']]
-- Table: customer address history
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['date to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order date', 'time'], ['order status code', 'text']]
-- Table: order items
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['order quantity', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the product type and name for the products with price higher than 1000 or lower than 500.` to a syntactically-correct PostgreSQL query.
| SELECT product_type_code , product_name FROM products WHERE product_price > 1000 OR product_price < 500 |
Find the name of dorms only for female (F gender). |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the name of dorms only for female (F gender).` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name FROM dorm WHERE gender = 'F' |
What are the names of the all-female dorms? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 all-female dorms?` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name FROM dorm WHERE gender = 'F' |
Find the name of dorms that can accommodate more than 300 students. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the name of dorms that can accommodate more than 300 students.` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name FROM dorm WHERE student_capacity > 300 |
What are the names of all the dorms that can accomdate more than 300 students? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 the dorms that can accomdate more than 300 students?` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name FROM dorm WHERE student_capacity > 300 |
How many female students (sex is F) whose age is below 25? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 female students (sex is F) whose age is below 25?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM student WHERE sex = 'F' AND age < 25 |
How many girl students who are younger than 25? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 girl students who are younger than 25?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM student WHERE sex = 'F' AND age < 25 |
Find the first name of students who is older than 20. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the first name of students who is older than 20.` to a syntactically-correct PostgreSQL query.
| SELECT fname FROM student WHERE age > 20 |
What are the first names of all students who are older than 20? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 first names of all students who are older than 20?` to a syntactically-correct PostgreSQL query.
| SELECT fname FROM student WHERE age > 20 |
Find the first name of students living in city PHL whose age is between 20 and 25. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the first name of students living in city PHL whose age is between 20 and 25.` to a syntactically-correct PostgreSQL query.
| SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 |
What is the first name of the students who are in age 20 to 25 and living in PHL city? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 first name of the students who are in age 20 to 25 and living in PHL city?` to a syntactically-correct PostgreSQL query.
| SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 |
How many dorms are there? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 dorms are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM dorm |
How many dorms are in the database? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 dorms are in the database?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM dorm |
Find the number of distinct amenities. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the number of distinct amenities.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM dorm_amenity |
How many diffrent dorm amenities are there? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 diffrent dorm amenities are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM dorm_amenity |
Find the total capacity of all dorms. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the total capacity of all dorms.` to a syntactically-correct PostgreSQL query.
| SELECT sum(student_capacity) FROM dorm |
What is the total student capacity of all dorms? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 total student capacity of all dorms?` to a syntactically-correct PostgreSQL query.
| SELECT sum(student_capacity) FROM dorm |
How many students are there? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 students are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM student |
How many students exist? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 students exist?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM student |
Find the average age of all students living in the each city. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the average age of all students living in the each city.` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , city_code FROM student GROUP BY city_code |
What is the average age for each city and what are those cities? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 age for each city and what are those cities?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , city_code FROM student GROUP BY city_code |
Find the average and total capacity of dorms for the students with gender X. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the average and total capacity of dorms for the students with gender X.` to a syntactically-correct PostgreSQL query.
| SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X' |
What is the average and total capacity for all dorms who are of gender X? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 and total capacity for all dorms who are of gender X?` to a syntactically-correct PostgreSQL query.
| SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X' |
Find the number of dorms that have some amenity. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the number of dorms that have some amenity.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT dormid) FROM has_amenity |
How many dorms have amenities? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 dorms have amenities?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT dormid) FROM has_amenity |
Find the name of dorms that do not have any amenity |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the name of dorms that do not have any amenity` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity) |
What are the names of all the dorms that don't have any amenities? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 the dorms that don't have any amenities?` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity) |
Find the number of distinct gender for dorms. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the number of distinct gender for dorms.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT gender) FROM dorm |
How many different genders are there in the dorms? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 different genders are there in the dorms?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT gender) FROM dorm |
Find the capacity and gender type of the dorm whose name has substring ‘Donor’. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the capacity and gender type of the dorm whose name has substring ‘Donor’.` to a syntactically-correct PostgreSQL query.
| SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%' |
What is the student capacity and type of gender for the dorm whose name as the phrase Donor in it? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 student capacity and type of gender for the dorm whose name as the phrase Donor in it?` to a syntactically-correct PostgreSQL query.
| SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%' |
Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 `Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100.` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name , gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 |
What are the names and types of the dorms that have a capacity greater than 300 or less than 100? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: dorm
columns : [['dorm id', 'number'], ['dorm name', 'text'], ['student capacity', 'number'], ['gender', 'text']]
-- Table: dorm amenity
columns : [['amenity id', 'number'], ['amenity name', 'text']]
-- Table: has amenity
columns : [['dorm id', 'number'], ['amenity id', 'number']]
-- Table: lives in
columns : [['student id', 'number'], ['dorm id', 'number'], ['room number', '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 and types of the dorms that have a capacity greater than 300 or less than 100?` to a syntactically-correct PostgreSQL query.
| SELECT dorm_name , gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 |