brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
How many branches where have more than average number of memberships are there? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 branches where have more than average number of memberships are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM branch WHERE membership_amount > (SELECT avg(membership_amount) FROM branch) |
What is the number of branches that have more than the average number of memberships? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 number of branches that have more than the average number of memberships?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM branch WHERE membership_amount > (SELECT avg(membership_amount) FROM branch) |
Show name, address road, and city for all branches sorted by open year. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show name, address road, and city for all branches sorted by open year.` to a syntactically-correct PostgreSQL query.
| SELECT name , address_road , city FROM branch ORDER BY open_year |
What are the names, address roads, and cities of the branches ordered by opening year? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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, address roads, and cities of the branches ordered by opening year?` to a syntactically-correct PostgreSQL query.
| SELECT name , address_road , city FROM branch ORDER BY open_year |
What are names for top three branches with most number of membership? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 names for top three branches with most number of membership?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3 |
What are the names for the 3 branches that have the most memberships? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names for the 3 branches that have the most memberships?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3 |
Show all distinct city where branches with at least 100 memberships are located. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all distinct city where branches with at least 100 memberships are located.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT city FROM branch WHERE membership_amount >= 100 |
What are the different cities that have more than 100 memberships? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 different cities that have more than 100 memberships?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT city FROM branch WHERE membership_amount >= 100 |
List all open years when at least two shops are opened. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 open years when at least two shops are opened.` to a syntactically-correct PostgreSQL query.
| SELECT open_year FROM branch GROUP BY open_year HAVING count(*) >= 2 |
What are the opening years in which at least two shops opened? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 opening years in which at least two shops opened?` to a syntactically-correct PostgreSQL query.
| SELECT open_year FROM branch GROUP BY open_year HAVING count(*) >= 2 |
Show minimum and maximum amount of memberships for all branches opened in 2011 or located at city London. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show minimum and maximum amount of memberships for all branches opened in 2011 or located at city London.` to a syntactically-correct PostgreSQL query.
| SELECT min(membership_amount) , max(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'London' |
What are the minimum and maximum membership amounts for all branches that either opened in 2011 or are located in London? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 minimum and maximum membership amounts for all branches that either opened in 2011 or are located in London?` to a syntactically-correct PostgreSQL query.
| SELECT min(membership_amount) , max(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'London' |
Show the city and the number of branches opened before 2010 for each city. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the city and the number of branches opened before 2010 for each city.` to a syntactically-correct PostgreSQL query.
| SELECT city , count(*) FROM branch WHERE open_year < 2010 GROUP BY city |
For each city, how many branches opened before 2010? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `For each city, how many branches opened before 2010?` to a syntactically-correct PostgreSQL query.
| SELECT city , count(*) FROM branch WHERE open_year < 2010 GROUP BY city |
How many different levels do members have? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 levels do members have?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT LEVEL) FROM member |
What are the different membership levels? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 different membership levels?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT LEVEL) FROM member |
Show card number, name, and hometown for all members in a descending order of level. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show card number, name, and hometown for all members in a descending order of level.` to a syntactically-correct PostgreSQL query.
| SELECT card_number , name , hometown FROM member ORDER BY LEVEL DESC |
What are the card numbers, names, and hometowns of every member ordered by descending level? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 card numbers, names, and hometowns of every member ordered by descending level?` to a syntactically-correct PostgreSQL query.
| SELECT card_number , name , hometown FROM member ORDER BY LEVEL DESC |
Show the membership level with most number of members. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the membership level with most number of members.` to a syntactically-correct PostgreSQL query.
| SELECT LEVEL FROM member GROUP BY LEVEL ORDER BY count(*) DESC LIMIT 1 |
What is the membership level with the most people? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 membership level with the most people?` to a syntactically-correct PostgreSQL query.
| SELECT LEVEL FROM member GROUP BY LEVEL ORDER BY count(*) DESC LIMIT 1 |
Show all member names and registered branch names sorted by register year. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all member names and registered branch names sorted by register year.` to a syntactically-correct PostgreSQL query.
| SELECT T3.name , T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year |
What are the names of the members and branches at which they are registered sorted by year of registration? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 members and branches at which they are registered sorted by year of registration?` to a syntactically-correct PostgreSQL query.
| SELECT T3.name , T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year |
Show all branch names with the number of members in each branch registered after 2015. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all branch names with the number of members in each branch registered after 2015.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , count(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id |
For each branch id, what are the names of the branches that were registered after 2015? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `For each branch id, what are the names of the branches that were registered after 2015?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , count(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id |
Show member names without any registered branch. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show member names without any registered branch.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch) |
What are the names of the members that have never registered at any branch? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 members that have never registered at any branch?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch) |
List the branch name and city without any registered members. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 the branch name and city without any registered members.` to a syntactically-correct PostgreSQL query.
| SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch) |
What are the names and cities of the branches that do not have any registered members? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 cities of the branches that do not have any registered members?` to a syntactically-correct PostgreSQL query.
| SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch) |
What is the name and open year for the branch with most number of memberships registered in 2016? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name and open year for the branch with most number of memberships registered in 2016?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1 |
What is the name and opening year for the branch that registered the most members in 2016? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name and opening year for the branch that registered the most members in 2016?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1 |
Show the member name and hometown who registered a branch in 2016. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the member name and hometown who registered a branch in 2016.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016 |
What are the member names and hometowns of those who registered at a branch in 2016? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 member names and hometowns of those who registered at a branch in 2016?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016 |
Show all city with a branch opened in 2001 and a branch with more than 100 membership. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all city with a branch opened in 2001 and a branch with more than 100 membership.` to a syntactically-correct PostgreSQL query.
| SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100 |
What are the cities that have a branch that opened in 2001 and a branch with more than 100 members? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 cities that have a branch that opened in 2001 and a branch with more than 100 members?` to a syntactically-correct PostgreSQL query.
| SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100 |
Show all cities without a branch having more than 100 memberships. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all cities without a branch having more than 100 memberships.` to a syntactically-correct PostgreSQL query.
| SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100 |
What are the cities that do not have any branches with more than 100 members? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 cities that do not have any branches with more than 100 members?` to a syntactically-correct PostgreSQL query.
| SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100 |
What is the sum of total pounds of purchase in year 2018 for all branches in London? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 sum of total pounds of purchase in year 2018 for all branches in London?` to a syntactically-correct PostgreSQL query.
| SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018 |
How many total pounds were purchased in the year 2018 at all London branches? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 total pounds were purchased in the year 2018 at all London branches?` to a syntactically-correct PostgreSQL query.
| SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018 |
What is the total number of purchases for members with level 6? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 number of purchases for members with level 6?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6 |
What are the total purchases for members rated at level 6? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 total purchases for members rated at level 6?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6 |
Find the name of branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia. |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Hiram , Georgia' |
What are the names of the branches that have some members with a hometown in Louisville, Kentucky and also those from Hiram, Goergia? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 branches that have some members with a hometown in Louisville, Kentucky and also those from Hiram, Goergia?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Hiram , Georgia' |
list the card number of all members whose hometown address includes word "Kentucky". |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 the card number of all members whose hometown address includes word "Kentucky".` to a syntactically-correct PostgreSQL query.
| SELECT card_number FROM member WHERE Hometown LIKE "%Kentucky%" |
What are the card numbers of members from Kentucky? |
-- Language PostgreSQL
-- Tables:
-- Table: member
columns : [['member id', 'number'], ['card number', 'text'], ['name', 'text'], ['hometown', 'text'], ['level', 'number']]
-- Table: branch
columns : [['branch id', 'number'], ['name', 'text'], ['open year', 'text'], ['address road', 'text'], ['city', 'text'], ['membership amount', 'text']]
-- Table: membership register branch
columns : [['member id', 'number'], ['branch id', 'text'], ['register year', 'text']]
-- Table: purchase
columns : [['member id', 'number'], ['branch id', 'text'], ['year', 'text'], ['total pounds', '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 card numbers of members from Kentucky?` to a syntactically-correct PostgreSQL query.
| SELECT card_number FROM member WHERE Hometown LIKE "%Kentucky%" |
Find the number of students in total. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 students in total.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM STUDENT |
How many students are there in total? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 in total?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM STUDENT |
Find the number of voting records in total. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 voting records in total.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM VOTING_RECORD |
How many voting records do we have? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 voting records do we have?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM VOTING_RECORD |
Find the distinct number of president votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct number of president votes.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD |
How many distinct president votes are recorded? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct president votes are recorded?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD |
Find the maximum age of all the 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 maximum age of all the students.` to a syntactically-correct PostgreSQL query.
| SELECT max(Age) FROM STUDENT |
What is the oldest age among the 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 oldest age among the students?` to a syntactically-correct PostgreSQL query.
| SELECT max(Age) FROM STUDENT |
Find the last names of students with major 50. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 last names of students with major 50.` to a syntactically-correct PostgreSQL query.
| SELECT LName FROM STUDENT WHERE Major = 50 |
What are the last names of students studying major 50? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 last names of students studying major 50?` to a syntactically-correct PostgreSQL query.
| SELECT LName FROM STUDENT WHERE Major = 50 |
Find the first names of students with age above 22. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 names of students with age above 22.` to a syntactically-correct PostgreSQL query.
| SELECT Fname FROM STUDENT WHERE Age > 22 |
What are the first names of all the students aged above 22? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 the students aged above 22?` to a syntactically-correct PostgreSQL query.
| SELECT Fname FROM STUDENT WHERE Age > 22 |
What are the majors of male (sex is M) 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 majors of male (sex is M) students?` to a syntactically-correct PostgreSQL query.
| SELECT Major FROM STUDENT WHERE Sex = "M" |
List the major of each male student. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 the major of each male student.` to a syntactically-correct PostgreSQL query.
| SELECT Major FROM STUDENT WHERE Sex = "M" |
What is the average age of female (sex is F) 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 of female (sex is F) students?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Age) FROM STUDENT WHERE Sex = "F" |
Find the average age of female 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 female students.` to a syntactically-correct PostgreSQL query.
| SELECT avg(Age) FROM STUDENT WHERE Sex = "F" |
What are the maximum and minimum age of students with major 600? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 maximum and minimum age of students with major 600?` to a syntactically-correct PostgreSQL query.
| SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600 |
Tell me the ages of the oldest and youngest students studying major 600. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Tell me the ages of the oldest and youngest students studying major 600.` to a syntactically-correct PostgreSQL query.
| SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600 |
Who are the advisors for students that live in a city with city code "BAL"? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Who are the advisors for students that live in a city with city code "BAL"?` to a syntactically-correct PostgreSQL query.
| SELECT Advisor FROM STUDENT WHERE city_code = "BAL" |
Show the advisors of the students whose city of residence has city code "BAL". |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the advisors of the students whose city of residence has city code "BAL".` to a syntactically-correct PostgreSQL query.
| SELECT Advisor FROM STUDENT WHERE city_code = "BAL" |
What are the distinct secretary votes in the fall election cycle? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct secretary votes in the fall election cycle?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall" |
Return all the distinct secretary votes made in the fall election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Return all the distinct secretary votes made in the fall election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall" |
What are the distinct president votes on 08/30/2015? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct president votes on 08/30/2015?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = "08/30/2015" |
Show all the distinct president votes made on 08/30/2015. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all the distinct president votes made on 08/30/2015.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = "08/30/2015" |
Report the distinct registration date and the election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Report the distinct registration date and the election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Registration_Date , Election_Cycle FROM VOTING_RECORD |
What are the distinct registration dates and the election cycles? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct registration dates and the election cycles?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Registration_Date , Election_Cycle FROM VOTING_RECORD |
Report the distinct president vote and the vice president vote. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Report the distinct president vote and the vice president vote.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT President_Vote , VICE_President_Vote FROM VOTING_RECORD |
List all the distinct president votes and the vice president votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct president votes and the vice president votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT President_Vote , VICE_President_Vote FROM VOTING_RECORD |
Find the distinct last names of the students who have class president votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct last names of the students who have class president votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE |
What are the distinct last names of the students who have class president votes? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct last names of the students who have class president votes?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE |
Find the distinct first names of the students who have class senator votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct first names of the students who have class senator votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE |
What are the distinct first names of the students who have class president votes? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct first names of the students who have class president votes?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE |
Find the distinct ages of students who have secretary votes in the fall election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct ages of students who have secretary votes in the fall election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall" |
What are the distinct ages of students who have secretary votes in the fall election cycle? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct ages of students who have secretary votes in the fall election cycle?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall" |
Find the distinct Advisor of students who have treasurer votes in the spring election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct Advisor of students who have treasurer votes in the spring election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring" |
Who served as an advisor for students who have treasurer votes in the spring election cycle? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Who served as an advisor for students who have treasurer votes in the spring election cycle?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring" |
Find the distinct majors of students who have treasurer votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct majors of students who have treasurer votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote |
What are the distinct majors that students with treasurer votes are studying? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct majors that students with treasurer votes are studying?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote |
Find the first and last names of all the female (sex is F) students who have president votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 and last names of all the female (sex is F) students who have president votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "F" |
What are the first and last names of all the female students who have president votes? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 and last names of all the female students who have president votes?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "F" |
Find the first and last name of all the students of age 18 who have vice president votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 and last name of all the students of age 18 who have vice president votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18 |
What are the first names and last names of the students who are 18 years old and have vice president votes. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 and last names of the students who are 18 years old and have vice president votes.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18 |
How many male (sex is M) students have class senator votes in the fall election cycle? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 male (sex is M) students have class senator votes in the fall election cycle?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = "M" AND T2.Election_Cycle = "Fall" |
Count the number of male students who had class senator votes in the fall election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 `Count the number of male students who had class senator votes in the fall election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = "M" AND T2.Election_Cycle = "Fall" |
Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 students whose city code is NYC and who have class senator votes in the spring election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring" |
Which students live in the city with code "NYC" and have class senator votes in the spring election cycle? Count the numbers. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 students live in the city with code "NYC" and have class senator votes in the spring election cycle? Count the numbers.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring" |
Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 students who live in the city with code "NYC" and have secretary votes in the spring election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring" |
What is the average age of students who have city code "NYC" and have secretary votes for the spring election cycle? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 of students who have city code "NYC" and have secretary votes for the spring election cycle?` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring" |
Find the average age of female (sex is F) students who have secretary votes in the spring election cycle. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 female (sex is F) students who have secretary votes in the spring election cycle.` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = "F" AND T2.Election_Cycle = "Spring" |
What is the average age of the female students with secretary votes in the spring election cycle? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 of the female students with secretary votes in the spring election cycle?` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = "F" AND T2.Election_Cycle = "Spring" |
Find the distinct first names of all the students who have vice president votes and whose city code is not PIT. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct first names of all the students who have vice president votes and whose city code is not PIT.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT" |
What are the distinct first names of the students who have vice president votes and reside in a city whose city code is not PIT? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct first names of the students who have vice president votes and reside in a city whose city code is not PIT?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT" |
Find the distinct last names of all the students who have president votes and whose advisor is not 2192. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct last names of all the students who have president votes and whose advisor is not 2192.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "2192" |
What are the distinct last names of the students who have president votes but do not have 2192 as the advisor? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct last names of the students who have president votes but do not have 2192 as the advisor?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "2192" |
Find the distinct last names of all the students who have president votes and whose advisor is 8741. |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct last names of all the students who have president votes and whose advisor is 8741.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741" |
What are the distinct last names of the students who have president votes and have 8741 as the advisor? |
-- 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: voting record
columns : [['student id', 'number'], ['registration date', 'text'], ['election cycle', 'text'], ['president vote', 'number'], ['vice president vote', 'number'], ['secretary vote', 'number'], ['treasurer vote', 'number'], ['class president vote', 'number'], ['class senator vote', '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 distinct last names of the students who have president votes and have 8741 as the advisor?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.