brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
How many females does this network has? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 females does this network has?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Person WHERE gender = 'female' |
How many females are in the network? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 females are in the network?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Person WHERE gender = 'female' |
What is the average age for all person? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average age for all person?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) FROM Person |
What is the average age for all people in the table? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average age for all people in the table?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) FROM Person |
How many different cities are they from? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 cities are they from?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT city) FROM Person |
How many different cities do people originate from? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 cities do people originate from?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT city) FROM Person |
How many type of jobs do they have? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 type of jobs do they have?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT job) FROM Person |
How many different jobs are listed? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 jobs are listed?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT job) FROM Person |
Who is the oldest person? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 is the oldest person?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE age = (SELECT max(age) FROM person) |
What is the name of the person who is the oldest? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the person who is the oldest?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE age = (SELECT max(age) FROM person) |
Who is the oldest person whose job is student? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 is the oldest person whose job is student?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE job = 'student' AND age = (SELECT max(age) FROM person WHERE job = 'student' ) |
What is the name of the oldest student? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the oldest student?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE job = 'student' AND age = (SELECT max(age) FROM person WHERE job = 'student' ) |
Who is the youngest male? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 is the youngest male?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT min(age) FROM person WHERE gender = 'male' ) |
What is the name of the youngest male? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the youngest male?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT min(age) FROM person WHERE gender = 'male' ) |
How old is the doctor named Zach? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 old is the doctor named Zach?` to a syntactically-correct PostgreSQL query.
| SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach' |
What is the age of the doctor named Zach? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 age of the doctor named Zach?` to a syntactically-correct PostgreSQL query.
| SELECT age FROM Person WHERE job = 'doctor' AND name = 'Zach' |
Who is the person whose age is below 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 is the person whose age is below 30?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE age < 30 |
What is the name of the person whose age is below 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the person whose age is below 30?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE age < 30 |
How many people whose age is greater 30 and job is engineer? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people whose age is greater 30 and job is engineer?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Person WHERE age > 30 AND job = 'engineer' |
HOw many engineers are older than 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 engineers are older than 30?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Person WHERE age > 30 AND job = 'engineer' |
What is the average age for each gender? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average age for each gender?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , gender FROM Person GROUP BY gender |
How old is each gender, on average? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 old is each gender, on average?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , gender FROM Person GROUP BY gender |
What is average age for different job title? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 average age for different job title?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , job FROM Person GROUP BY job |
How old is the average person for each job? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 old is the average person for each job?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , job FROM Person GROUP BY job |
What is average age of male for different job title? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 average age of male for different job title?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , job FROM Person WHERE gender = 'male' GROUP BY job |
What is the average age for a male in each job? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average age for a male in each job?` to a syntactically-correct PostgreSQL query.
| SELECT avg(age) , job FROM Person WHERE gender = 'male' GROUP BY job |
What is minimum age for different job title? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 minimum age for different job title?` to a syntactically-correct PostgreSQL query.
| SELECT min(age) , job FROM Person GROUP BY job |
How old is the youngest person for each job? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 old is the youngest person for each job?` to a syntactically-correct PostgreSQL query.
| SELECT min(age) , job FROM Person GROUP BY job |
Find the number of people who is under 40 for each gender. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people who is under 40 for each gender.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , gender FROM Person WHERE age < 40 GROUP BY gender |
How many people are under 40 for each gender? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people are under 40 for each gender?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , gender FROM Person WHERE age < 40 GROUP BY gender |
Find the name of people whose age is greater than any engineer sorted by their age. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people whose age is greater than any engineer sorted by their age.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE age > (SELECT min(age) FROM person WHERE job = 'engineer') ORDER BY age |
What is the name of all the people who are older than at least one engineer? Order them by age. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of all the people who are older than at least one engineer? Order them by age.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE age > (SELECT min(age) FROM person WHERE job = 'engineer') ORDER BY age |
Find the number of people whose age is greater than all engineers. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people whose age is greater than all engineers.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Person WHERE age > (SELECT max(age) FROM person WHERE job = 'engineer') |
How many people are older than every engineer? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people are older than every engineer?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Person WHERE age > (SELECT max(age) FROM person WHERE job = 'engineer') |
list the name, job title of all people ordered by their names. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 name, job title of all people ordered by their names.` to a syntactically-correct PostgreSQL query.
| SELECT name , job FROM Person ORDER BY name |
What are the names and job titles of every person ordered alphabetically by name? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 job titles of every person ordered alphabetically by name?` to a syntactically-correct PostgreSQL query.
| SELECT name , job FROM Person ORDER BY name |
Find the names of all person sorted in the descending order using age. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of all person sorted in the descending order using age.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person ORDER BY age DESC |
What are the names of everybody sorted by age in descending order? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 everybody sorted by age in descending order?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person ORDER BY age DESC |
Find the name and age of all males in order of their age. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and age of all males in order of their age.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE gender = 'male' ORDER BY age |
What is the name and age of every male? Order the results by age. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 age of every male? Order the results by age.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Person WHERE gender = 'male' ORDER BY age |
Find the name and age of the person who is a friend of both Dan and Alice. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and age of the person who is a friend of both Dan and Alice.` to a syntactically-correct PostgreSQL query.
| SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' |
What are the names and ages of every person who is a friend of both Dan and Alice? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 ages of every person who is a friend of both Dan and Alice?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' |
Find the name and age of the person who is a friend of Dan or Alice. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and age of the person who is a friend of Dan or Alice.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice' |
What are the different names and ages of every friend of either Dan or alice? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 names and ages of every friend of either Dan or alice?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' OR T2.friend = 'Alice' |
Find the name of the person who has friends with age above 40 and under age 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the person who has friends with age above 40 and under age 30?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) INTERSECT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) |
What are the names of every person who has a friend over 40 and under 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 every person who has a friend over 40 and under 30?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) INTERSECT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) |
Find the name of the person who has friends with age above 40 but not under age 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the person who has friends with age above 40 but not under age 30?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) |
What are the names of the people who are older 40 but no friends under age 30? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people who are older 40 but no friends under age 30?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age > 40) EXCEPT SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend IN (SELECT name FROM Person WHERE age < 30) |
Find the name of the person who has no student friends. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the person who has no student friends.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student' |
What are the names of the people who have no friends who are students? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people who have no friends who are students?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student' |
Find the person who has exactly one friend. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 person who has exactly one friend.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM PersonFriend GROUP BY name HAVING count(*) = 1 |
What are the names of everybody who has exactly one friend? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 everybody who has exactly one friend?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM PersonFriend GROUP BY name HAVING count(*) = 1 |
Who are the friends of Bob? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 friends of Bob?` to a syntactically-correct PostgreSQL query.
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob' |
Who are Bob's friends? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 Bob's friends?` to a syntactically-correct PostgreSQL query.
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Bob' |
Find the name of persons who are friends with Bob. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 persons who are friends with Bob.` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob' |
What are the names of all of Bob's friends? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all of Bob's friends?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Bob' |
Find the names of females who are friends with Zach |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of females who are friends with Zach` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female' |
What are the names of all females who are friends with Zach? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all females who are friends with Zach?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Zach' AND T1.gender = 'female' |
Find the female friends of Alice. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 female friends of Alice.` to a syntactically-correct PostgreSQL query.
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female' |
What are all the friends of Alice who are female? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 all the friends of Alice who are female?` to a syntactically-correct PostgreSQL query.
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female' |
Find the male friend of Alice whose job is a doctor? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 male friend of Alice whose job is a doctor?` to a syntactically-correct PostgreSQL query.
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor' |
Who are the friends of Alice that are doctors? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 friends of Alice that are doctors?` to a syntactically-correct PostgreSQL query.
| SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'male' AND T1.job = 'doctor' |
Who has a friend that is from new york city? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 has a friend that is from new york city?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city' |
What are the names of all friends who are from New York? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all friends who are from New York?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.city = 'new york city' |
Who has friends that are younger than the average age? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 has friends that are younger than the average age?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age < (SELECT avg(age) FROM person) |
What are the different names of friends who are younger than the average age for a friend? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 names of friends who are younger than the average age for a friend?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age < (SELECT avg(age) FROM person) |
Who has friends that are older than the average age? Print their friends and their ages as well |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 has friends that are older than the average age? Print their friends and their ages as well` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.name , T2.friend , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT avg(age) FROM person) |
Whare the names, friends, and ages of all people who are older than the average age of a person? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 `Whare the names, friends, and ages of all people who are older than the average age of a person?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.name , T2.friend , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT avg(age) FROM person) |
Who is the friend of Zach with longest year relationship? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 is the friend of Zach with longest year relationship?` to a syntactically-correct PostgreSQL query.
| SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT max(YEAR) FROM PersonFriend WHERE name = 'Zach') |
Which friend of Zach has the longest-lasting friendship? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 friend of Zach has the longest-lasting friendship?` to a syntactically-correct PostgreSQL query.
| SELECT friend FROM PersonFriend WHERE name = 'Zach' AND YEAR = (SELECT max(YEAR) FROM PersonFriend WHERE name = 'Zach') |
What is the age of the friend of Zach with longest year relationship? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 age of the friend of Zach with longest year relationship?` to a syntactically-correct PostgreSQL query.
| SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE name = 'Zach') |
What are the ages of all of Zach's friends who are in the longest relationship? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 ages of all of Zach's friends who are in the longest relationship?` to a syntactically-correct PostgreSQL query.
| SELECT T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Zach' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE name = 'Zach') |
Find the name of persons who are friends with Alice for the shortest years. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 persons who are friends with Alice for the shortest years.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT min(YEAR) FROM PersonFriend WHERE friend = 'Alice') |
What are the names of all people who are friends with Alice for the shortest amount of time? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all people who are friends with Alice for the shortest amount of time?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM PersonFriend WHERE friend = 'Alice' AND YEAR = (SELECT min(YEAR) FROM PersonFriend WHERE friend = 'Alice') |
Find the name, age, and job title of persons who are friends with Alice for the longest years. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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, age, and job title of persons who are friends with Alice for the longest years.` to a syntactically-correct PostgreSQL query.
| SELECT T1.name , T1.age , T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE friend = 'Alice') |
What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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, ages, and jobs of all people who are friends with Alice for the longest amount of time?` to a syntactically-correct PostgreSQL query.
| SELECT T1.name , T1.age , T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE friend = 'Alice') |
Who is the person that has no friend? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 is the person that has no friend?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM person EXCEPT SELECT name FROM PersonFriend |
What are the names of all people who do not have friends? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all people who do not have friends?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM person EXCEPT SELECT name FROM PersonFriend |
Which person whose friends have the oldest average age? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 person whose friends have the oldest average age?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , avg(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY avg(T1.age) DESC LIMIT 1 |
What is the name of the person who has the oldest average age for their friends, and what is that average age? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the person who has the oldest average age for their friends, and what is that average age?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , avg(T1.age) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend GROUP BY T2.name ORDER BY avg(T1.age) DESC LIMIT 1 |
What is the total number of people who has no friend living in the city of Austin. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people who has no friend living in the city of Austin.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE city = 'Austin') |
What is the total number of people who have no friends living in Austin? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 people who have no friends living in Austin?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT name) FROM PersonFriend WHERE friend NOT IN (SELECT name FROM person WHERE city = 'Austin') |
Find Alice's friends of friends. |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 Alice's friends of friends.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name != 'Alice' |
What are the names of all of Alice's friends of friends? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all of Alice's friends of friends?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T4.name FROM PersonFriend AS T1 JOIN Person AS T2 ON T1.name = T2.name JOIN PersonFriend AS T3 ON T1.friend = T3.name JOIN PersonFriend AS T4 ON T3.friend = T4.name WHERE T2.name = 'Alice' AND T4.name != 'Alice' |
How many members are there? |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 members are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM member |
List the names of members in ascending alphabetical order. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members in ascending alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM member ORDER BY Name ASC |
What are the names and countries of members? |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 countries of members?` to a syntactically-correct PostgreSQL query.
| SELECT Name , Country FROM member |
Show the names of members whose country is "United States" or "Canada". |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members whose country is "United States" or "Canada".` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM member WHERE Country = "United States" OR Country = "Canada" |
Show the different countries and the number of members from each. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 different countries and the number of members from each.` to a syntactically-correct PostgreSQL query.
| SELECT Country , COUNT(*) FROM member GROUP BY Country |
Show the most common country across members. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 most common country across members.` to a syntactically-correct PostgreSQL query.
| SELECT Country FROM member GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1 |
Which countries have more than two members? |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which countries have more than two members?` to a syntactically-correct PostgreSQL query.
| SELECT Country FROM member GROUP BY Country HAVING COUNT(*) > 2 |
Show the leader names and locations of colleges. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 leader names and locations of colleges.` to a syntactically-correct PostgreSQL query.
| SELECT Leader_Name , College_Location FROM college |
Show the names of members and names of colleges they go to. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members and names of colleges they go to.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Name , T1.Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID |
Show the names of members and the locations of colleges they go to in ascending alphabetical order of member names. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members and the locations of colleges they go to in ascending alphabetical order of member names.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Name , T1.College_Location FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID ORDER BY T2.Name ASC |
Show the distinct leader names of colleges associated with members from country "Canada". |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 distinct leader names of colleges associated with members from country "Canada".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T1.Leader_Name FROM college AS T1 JOIN member AS T2 ON T1.College_ID = T2.College_ID WHERE T2.Country = "Canada" |
Show the names of members and the decoration themes they have. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members and the decoration themes they have.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Name , T2.Decoration_Theme FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID |
Show the names of members that have a rank in round higher than 3. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members that have a rank in round higher than 3.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID WHERE T2.Rank_in_Round > 3 |
Show the names of members in ascending order of their rank in rounds. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members in ascending order of their rank in rounds.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Name FROM member AS T1 JOIN round AS T2 ON T1.Member_ID = T2.Member_ID ORDER BY Rank_in_Round ASC |
List the names of members who did not participate in any round. |
-- Language PostgreSQL
-- Tables:
-- Table: college
columns : [['college id', 'number'], ['name', 'text'], ['leader name', 'text'], ['college location', 'text']]
-- Table: member
columns : [['member id', 'number'], ['name', 'text'], ['country', 'text'], ['college id', 'number']]
-- Table: round
columns : [['round id', 'number'], ['member id', 'number'], ['decoration theme', 'text'], ['rank in round', '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 names of members who did not participate in any round.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM round) |
Find the name and access counts of all documents, in alphabetic order of the document name. |
-- Language PostgreSQL
-- Tables:
-- Table: roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: users
columns : [['user id', 'number'], ['role code', 'text'], ['user name', 'text'], ['user login', 'text'], ['password', 'text']]
-- Table: document structures
columns : [['document structure code', 'text'], ['parent document structure code', 'text'], ['document structure description', 'text']]
-- Table: functional areas
columns : [['functional area code', 'text'], ['parent functional area code', 'text'], ['functional area description', 'text']]
-- Table: images
columns : [['image id', 'number'], ['image alt text', 'text'], ['image name', 'text'], ['image url', 'text']]
-- Table: documents
columns : [['document code', 'text'], ['document structure code', 'text'], ['document type code', 'text'], ['access count', 'number'], ['document name', 'text']]
-- Table: document functional areas
columns : [['document code', 'text'], ['functional area code', 'text']]
-- Table: document sections
columns : [['section id', 'number'], ['document code', 'text'], ['section sequence', 'number'], ['section code', 'text'], ['section title', 'text']]
-- Table: document sections images
columns : [['section id', 'number'], ['image id', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and access counts of all documents, in alphabetic order of the document name.` to a syntactically-correct PostgreSQL query.
| SELECT document_name , access_count FROM documents ORDER BY document_name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.