brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
Find the id of the candidate who got the lowest oppose rate. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 id of the candidate who got the lowest oppose rate.` to a syntactically-correct PostgreSQL query.
| SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1 |
What is the id of the candidate with the lowest oppose rate? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 id of the candidate with the lowest oppose rate?` to a syntactically-correct PostgreSQL query.
| SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1 |
Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate.` to a syntactically-correct PostgreSQL query.
| SELECT Support_rate , Consider_rate , Oppose_rate FROM candidate ORDER BY unsure_rate |
What are the support, consider, and oppose rates of each candidate, ordered ascending by their unsure rate? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 support, consider, and oppose rates of each candidate, ordered ascending by their unsure rate?` to a syntactically-correct PostgreSQL query.
| SELECT Support_rate , Consider_rate , Oppose_rate FROM candidate ORDER BY unsure_rate |
which poll source does the highest oppose rate come from? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 poll source does the highest oppose rate come from?` to a syntactically-correct PostgreSQL query.
| SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1 |
Return the poll source corresponding to the candidate who has the oppose rate. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 the poll source corresponding to the candidate who has the oppose rate.` to a syntactically-correct PostgreSQL query.
| SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1 |
List all people names in the order of their date of birth from old to young. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 people names in the order of their date of birth from old to young.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people ORDER BY date_of_birth |
What are the names of all people, ordered by their date of birth? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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, ordered by their date of birth?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people ORDER BY date_of_birth |
Find the average height and weight for all males (sex is M). |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 height and weight for all males (sex is M).` to a syntactically-correct PostgreSQL query.
| SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M' |
What are the average height and weight across males (sex is M)? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the average height and weight across males (sex is M)?` to a syntactically-correct PostgreSQL query.
| SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M' |
find the names of people who are taller than 200 or lower than 190. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 people who are taller than 200 or lower than 190.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people WHERE height > 200 OR height < 190 |
What are the names of people who have a height greater than 200 or less than 190? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 people who have a height greater than 200 or less than 190?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people WHERE height > 200 OR height < 190 |
Find the average and minimum weight for each gender. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the average and minimum weight for each gender.` to a syntactically-correct PostgreSQL query.
| SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex |
What are the average and minimum weights for people of each sex? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the average and minimum weights for people of each sex?` to a syntactically-correct PostgreSQL query.
| SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex |
Find the name and gender of the candidate who got the highest support rate. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and gender of the candidate who got the highest support rate.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name , t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1 |
What is the name and sex of the candidate with the highest support rate? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 sex of the candidate with the highest support rate?` to a syntactically-correct PostgreSQL query.
| SELECT t1.name , t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1 |
Find the name of the candidates whose oppose percentage is the lowest for each sex. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 candidates whose oppose percentage is the lowest for each sex.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name , t1.sex , min(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex |
For each sex, what is the name and sex of the candidate with the oppose rate for their sex? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 sex, what is the name and sex of the candidate with the oppose rate for their sex?` to a syntactically-correct PostgreSQL query.
| SELECT t1.name , t1.sex , min(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex |
which gender got the highest average uncertain ratio. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 gender got the highest average uncertain ratio.` to a syntactically-correct PostgreSQL query.
| SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex ORDER BY avg(t2.unsure_rate) DESC LIMIT 1 |
What is the sex of the candidate who had the highest unsure rate? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 sex of the candidate who had the highest unsure rate?` to a syntactically-correct PostgreSQL query.
| SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex ORDER BY avg(t2.unsure_rate) DESC LIMIT 1 |
what are the names of people who did not participate in the candidate election. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 people who did not participate in the candidate election.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate) |
Give the names of people who did not participate in the candidate election. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Give the names of people who did not participate in the candidate election.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate) |
Find the names of the candidates whose support percentage is lower than their oppose rate. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of the candidates whose support percentage is lower than their oppose rate.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate |
What are the names of candidates who have a lower support rate than oppose rate? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 candidates who have a lower support rate than oppose rate?` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate |
how many people are there whose weight is higher than 85 for each gender? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 there whose weight is higher than 85 for each gender?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex |
Count the number of people of each sex who have a weight higher than 85. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 people of each sex who have a weight higher than 85.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex |
find the highest support percentage, lowest consider rate and oppose rate of all candidates. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 highest support percentage, lowest consider rate and oppose rate of all candidates.` to a syntactically-correct PostgreSQL query.
| SELECT max(support_rate) , min(consider_rate) , min(oppose_rate) FROM candidate |
Return the maximum support rate, minimum consider rate, and minimum oppose rate across all candidates? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 the maximum support rate, minimum consider rate, and minimum oppose rate across all candidates?` to a syntactically-correct PostgreSQL query.
| SELECT max(support_rate) , min(consider_rate) , min(oppose_rate) FROM candidate |
list all female (sex is F) candidate names in the alphabetical order. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 female (sex is F) candidate names in the alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name |
What are the names of all female candidates in alphabetical order (sex is F)? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 female candidates in alphabetical order (sex is F)?` to a syntactically-correct PostgreSQL query.
| SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name |
find the name of people whose height is lower than the average. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 height is lower than the average.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people WHERE height < (SELECT avg(height) FROM people) |
What are the names of people who are shorter than average? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 people who are shorter than average?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM people WHERE height < (SELECT avg(height) FROM people) |
List all info about all people. |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 info about all people.` to a syntactically-correct PostgreSQL query.
| SELECT * FROM people |
What is all the information about all people? |
-- Language PostgreSQL
-- Tables:
-- Table: candidate
columns : [['candidate id', 'number'], ['people id', 'number'], ['poll source', 'text'], ['date', 'text'], ['support rate', 'number'], ['consider rate', 'number'], ['oppose rate', 'number'], ['unsure rate', 'number']]
-- Table: people
columns : [['people id', 'number'], ['sex', 'text'], ['name', 'text'], ['date of birth', 'text'], ['height', 'number'], ['weight', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 all the information about all people?` to a syntactically-correct PostgreSQL query.
| SELECT * FROM people |
Find the titles of all movies directed by steven spielberg. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles of all movies directed by steven spielberg.` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE director = 'Steven Spielberg' |
What are the names of all movies directed by Steven Spielberg? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movies directed by Steven Spielberg?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE director = 'Steven Spielberg' |
What is the name of the movie produced after 2000 and directed by James Cameron? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movie produced after 2000 and directed by James Cameron?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000 |
What are the titles of all movies that James Cameron directed after 2000? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles of all movies that James Cameron directed after 2000?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000 |
How many movies were made before 2000? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movies were made before 2000?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Movie WHERE YEAR < 2000 |
How many movies were made before 2000? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movies were made before 2000?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Movie WHERE YEAR < 2000 |
Who is the director of movie Avatar? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 director of movie Avatar?` to a syntactically-correct PostgreSQL query.
| SELECT director FROM Movie WHERE title = 'Avatar' |
Who directed Avatar? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directed Avatar?` to a syntactically-correct PostgreSQL query.
| SELECT director FROM Movie WHERE title = 'Avatar' |
How many reviewers listed? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewers listed?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Reviewer |
How many reviewers are there? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewers are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Reviewer |
What is the id of the reviewer whose name has substring “Mike”? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 id of the reviewer whose name has substring “Mike”?` to a syntactically-correct PostgreSQL query.
| SELECT rID FROM Reviewer WHERE name LIKE "%Mike%" |
What is the id of the reviewer whose name includes the word "Mike"? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 id of the reviewer whose name includes the word "Mike"?` to a syntactically-correct PostgreSQL query.
| SELECT rID FROM Reviewer WHERE name LIKE "%Mike%" |
What is the reviewer id of Daniel Lewis? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewer id of Daniel Lewis?` to a syntactically-correct PostgreSQL query.
| SELECT rID FROM Reviewer WHERE name = "Daniel Lewis" |
What is the id of the reviewer named Daniel Lewis? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 id of the reviewer named Daniel Lewis?` to a syntactically-correct PostgreSQL query.
| SELECT rID FROM Reviewer WHERE name = "Daniel Lewis" |
What is the total number of ratings that has more than 3 stars? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 ratings that has more than 3 stars?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Rating WHERE stars > 3 |
How many movie ratings have more than 3 stars? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movie ratings have more than 3 stars?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Rating WHERE stars > 3 |
What is the lowest and highest rating star? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 lowest and highest rating star?` to a syntactically-correct PostgreSQL query.
| SELECT max(stars) , min(stars) FROM Rating |
What is the maximum and mininum number of stars a rating can receive? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the maximum and mininum number of stars a rating can receive?` to a syntactically-correct PostgreSQL query.
| SELECT max(stars) , min(stars) FROM Rating |
Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year |
In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year |
What are the names of directors who directed movies with 5 star rating? Also return the title of these movies. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who directed movies with 5 star rating? Also return the title of these movies.` to a syntactically-correct PostgreSQL query.
| SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5 |
What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who created a movie with a 5 star rating, and what was the name of those movies?` to a syntactically-correct PostgreSQL query.
| SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5 |
What is the average rating star for each reviewer? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 rating star for each reviewer?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name |
What is the average number of stars that each reviewer awards for a movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 number of stars that each reviewer awards for a movie?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name |
Find the titles of all movies that have no ratings. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles of all movies that have no ratings.` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating) |
What are the titles of all movies that have not been rated? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles of all movies that have not been rated?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating) |
Find the names of all reviewers who have ratings with a NULL value for the date. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewers who have ratings with a NULL value for the date.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null" |
What are the different names of all reviewers whose ratings do not have a date field? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 all reviewers whose ratings do not have a date field?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null" |
What is the average rating stars and title for the oldest movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 rating stars and title for the oldest movie?` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT min(YEAR) FROM Movie) |
For the oldest movie listed, what is its average rating and title? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 the oldest movie listed, what is its average rating and title?` to a syntactically-correct PostgreSQL query.
| SELECT avg(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT min(YEAR) FROM Movie) |
What is the name of the most recent movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 most recent movie?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie) |
What is the title of the newest movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 title of the newest movie?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie) |
What is the maximum stars and year for the most recent movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the maximum stars and year for the most recent movie?` to a syntactically-correct PostgreSQL query.
| SELECT max(T1.stars) , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT max(YEAR) FROM Movie) |
What is highest rating for the most recent movie and when was it released? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 highest rating for the most recent movie and when was it released?` to a syntactically-correct PostgreSQL query.
| SELECT max(T1.stars) , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT max(YEAR) FROM Movie) |
What is the names of movies whose created year is after all movies directed by Steven Spielberg? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 names of movies whose created year is after all movies directed by Steven Spielberg?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg") |
What are the names of all movies that were created after the most recent Steven Spielberg film? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movies that were created after the most recent Steven Spielberg film?` to a syntactically-correct PostgreSQL query.
| SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg") |
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron?` to a syntactically-correct PostgreSQL query.
| SELECT T2.title , T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = "James Cameron") |
What are the titles and directors of all movies that have a rating higher than the average James Cameron film rating? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles and directors of all movies that have a rating higher than the average James Cameron film rating?` to a syntactically-correct PostgreSQL query.
| SELECT T2.title , T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = "James Cameron") |
Return reviewer name, movie title, stars, and ratingDate. And sort the data first by reviewer name, then by movie title, and lastly by number of stars. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewer name, movie title, stars, and ratingDate. And sort the data first by reviewer name, then by movie title, and lastly by number of stars.` to a syntactically-correct PostgreSQL query.
| SELECT T3.name , T2.title , T1.stars , T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name , T2.title , T1.stars |
What is the reviewer name, film title, movie rating, and rating date for every movie ordered by reviewer name, movie title, then finally rating? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewer name, film title, movie rating, and rating date for every movie ordered by reviewer name, movie title, then finally rating?` to a syntactically-correct PostgreSQL query.
| SELECT T3.name , T2.title , T1.stars , T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name , T2.title , T1.stars |
Find the names of all reviewers who have contributed three or more ratings. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewers who have contributed three or more ratings.` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3 |
What are the names of all reviewers that have rated 3 or more movies? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewers that have rated 3 or more movies?` to a syntactically-correct PostgreSQL query.
| SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3 |
Find the names of all reviewers who rated Gone with the Wind. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewers who rated Gone with the Wind.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind' |
What are the names of all the different reviewers who rates Gone with the Wind? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all the different reviewers who rates Gone with the Wind?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind' |
Find the names of all directors whose movies are rated by Sarah Martinez. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors whose movies are rated by Sarah Martinez.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Sarah Martinez' |
What are the names of all directors whose movies have been reviewed by Sarah Martinez? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors whose movies have been reviewed by Sarah Martinez?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Sarah Martinez' |
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T3.name , T2.title , T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name |
What are the different reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T3.name , T2.title , T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name |
Return all reviewer names and movie names together in a single list. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 reviewer names and movie names together in a single list.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Reviewer UNION SELECT title FROM Movie |
What are the names of all the reviewers and movie names? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of all the reviewers and movie names?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM Reviewer UNION SELECT title FROM Movie |
Find the titles of all movies not reviewed by Chris Jackson. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles of all movies not reviewed by Chris Jackson.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT title FROM Movie EXCEPT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Chris Jackson' |
What are the titles of all movies that were not reviewed by Chris Jackson? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles of all movies that were not reviewed by Chris Jackson?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT title FROM Movie EXCEPT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Chris Jackson' |
For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title.` to a syntactically-correct PostgreSQL query.
| SELECT T1.title , T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title ORDER BY T1.director , T1.title |
For all directors who have directed more than one movie, what movies have they directed and what are their names? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 all directors who have directed more than one movie, what movies have they directed and what are their names?` to a syntactically-correct PostgreSQL query.
| SELECT T1.title , T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title ORDER BY T1.director , T1.title |
For directors who had more than one movie, return the titles and produced years of all movies directed by them. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who had more than one movie, return the titles and produced years of all movies directed by them.` to a syntactically-correct PostgreSQL query.
| SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title |
For each director who directed more than one movie, what are the titles and dates of release for all those movies? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 director who directed more than one movie, what are the titles and dates of release for all those movies?` to a syntactically-correct PostgreSQL query.
| SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title |
What are the names of the directors who made exactly one movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who made exactly one movie?` to a syntactically-correct PostgreSQL query.
| SELECT director FROM Movie GROUP BY director HAVING count(*) = 1 |
What are the names of all directors who made one movie? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who made one movie?` to a syntactically-correct PostgreSQL query.
| SELECT director FROM Movie GROUP BY director HAVING count(*) = 1 |
What are the names of the directors who made exactly one movie excluding director NULL? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who made exactly one movie excluding director NULL?` to a syntactically-correct PostgreSQL query.
| SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1 |
What are the names of all directors who have made one movie except for the director named NULL? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 directors who have made one movie except for the director named NULL?` to a syntactically-correct PostgreSQL query.
| SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1 |
How many movie reviews does each director get? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movie reviews does each director get?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director |
For each director, how many reviews have they received? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 director, how many reviews have they received?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director |
Find the movies with the highest average rating. Return the movie titles and average rating. |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movies with the highest average rating. Return the movie titles and average rating.` to a syntactically-correct PostgreSQL query.
| SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) DESC LIMIT 1 |
What are the movie titles with the highest average rating and what are those ratings? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movie titles with the highest average rating and what are those ratings?` to a syntactically-correct PostgreSQL query.
| SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) DESC LIMIT 1 |
What are the movie titles and average rating of the movies with the lowest average rating? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 movie titles and average rating of the movies with the lowest average rating?` to a syntactically-correct PostgreSQL query.
| SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) LIMIT 1 |
What are the titles and average ratings for all movies that have the lowest average rating? |
-- Language PostgreSQL
-- Tables:
-- Table: movie
columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text']]
-- Table: reviewer
columns : [['reviewer id', 'number'], ['name', 'text']]
-- Table: rating
columns : [['reviewer id', 'number'], ['movie id', 'number'], ['rating stars', 'number'], ['rating date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables 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 titles and average ratings for all movies that have the lowest average rating?` to a syntactically-correct PostgreSQL query.
| SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) LIMIT 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.