brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Retrieve the country that has published the most papers.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Retrieve the country that has published the most papers.` to a syntactically-correct PostgreSQL query.
SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY count(*) DESC LIMIT 1
Find the country that the most papers are affiliated with.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the country that the most papers are affiliated with.` to a syntactically-correct PostgreSQL query.
SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY count(*) DESC LIMIT 1
Find the name of the organization that has published the largest number of papers.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 organization that has published the largest number of papers.` to a syntactically-correct PostgreSQL query.
SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY count(*) DESC LIMIT 1
Which institution has the most papers? Find the name of the institution.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 institution has the most papers? Find the name of the institution.` to a syntactically-correct PostgreSQL query.
SELECT t1.name FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.name ORDER BY count(*) DESC LIMIT 1
Find the titles of the papers that contain the word "ML".
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 the papers that contain the word "ML".` to a syntactically-correct PostgreSQL query.
SELECT title FROM papers WHERE title LIKE "%ML%"
Which papers have the substring "ML" in their titles? Return the titles of the papers.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 papers have the substring "ML" in their titles? Return the titles of the papers.` to a syntactically-correct PostgreSQL query.
SELECT title FROM papers WHERE title LIKE "%ML%"
Which paper's title contains the word "Database"?
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 paper's title contains the word "Database"?` to a syntactically-correct PostgreSQL query.
SELECT title FROM papers WHERE title LIKE "%Database%"
Which papers have the substring "Database" in their titles? Show the titles of the papers.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 papers have the substring "Database" in their titles? Show the titles of the papers.` to a syntactically-correct PostgreSQL query.
SELECT title FROM papers WHERE title LIKE "%Database%"
Find the first names of all the authors who have written a paper with title containing the word "Functional".
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the first names of all the authors who have written a paper with title containing the word "Functional".` to a syntactically-correct PostgreSQL query.
SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Functional%"
Who has written a paper that has the word "Functional" in its title? Return the first names of the authors.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Who has written a paper that has the word "Functional" in its title? Return the first names of the authors.` to a syntactically-correct PostgreSQL query.
SELECT t1.fname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Functional%"
Find the last names of all the authors that have written a paper with title containing the word "Monadic".
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the last names of all the authors that have written a paper with title containing the word "Monadic".` to a syntactically-correct PostgreSQL query.
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Monadic%"
Which authors have written a paper with title containing the word "Monadic"? Return their last names.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 authors have written a paper with title containing the word "Monadic"? Return their last names.` to a syntactically-correct PostgreSQL query.
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title LIKE "%Monadic%"
Retrieve the title of the paper that has the largest number of authors.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Retrieve the title of the paper that has the largest number of authors.` to a syntactically-correct PostgreSQL query.
SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT max(authorder) FROM authorship)
Which paper has the most authors? Give me the paper title.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 paper has the most authors? Give me the paper title.` to a syntactically-correct PostgreSQL query.
SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid = t2.paperid WHERE t1.authorder = (SELECT max(authorder) FROM authorship)
What is the first name of the author with last name "Ueno"?
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `What is the first name of the author with last name "Ueno"?` to a syntactically-correct PostgreSQL query.
SELECT fname FROM authors WHERE lname = "Ueno"
Which authors have last name "Ueno"? List their first names.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 authors have last name "Ueno"? List their first names.` to a syntactically-correct PostgreSQL query.
SELECT fname FROM authors WHERE lname = "Ueno"
Find the last name of the author with first name "Amal".
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the last name of the author with first name "Amal".` to a syntactically-correct PostgreSQL query.
SELECT lname FROM authors WHERE fname = "Amal"
Which authors have first name "Amal"? List their last names.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 authors have first name "Amal"? List their last names.` to a syntactically-correct PostgreSQL query.
SELECT lname FROM authors WHERE fname = "Amal"
Find the first names of all the authors ordered in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Find the first names of all the authors ordered in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT fname FROM authors ORDER BY fname
Sort the first names of all the authors in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Sort the first names of all the authors in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT fname FROM authors ORDER BY fname
Retrieve all the last names of authors in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Retrieve all the last names of authors in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT lname FROM authors ORDER BY lname
Give me a list of all the last names of authors sorted in alphabetical order
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables 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 me a list of all the last names of authors sorted in alphabetical order` to a syntactically-correct PostgreSQL query.
SELECT lname FROM authors ORDER BY lname
Retrieve all the first and last names of authors in the alphabetical order of last names.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Retrieve all the first and last names of authors in the alphabetical order of last names.` to a syntactically-correct PostgreSQL query.
SELECT fname , lname FROM authors ORDER BY lname
Sort the list of all the first and last names of authors in alphabetical order of the last names.
-- Language PostgreSQL -- Tables: -- Table: institution columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']] -- Table: authors columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']] -- Table: papers columns : [['paper id', 'number'], ['title', 'text']] -- Table: authorship count columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']] You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. You should not select columns that are not part of the tables provided to you. Think step by step. Your only output should be SQL code. Do not include any other text. Only SQL code. Translate `Sort the list of all the first and last names of authors in alphabetical order of the last names.` to a syntactically-correct PostgreSQL query.
SELECT fname , lname FROM authors ORDER BY lname
How many different last names do the actors and actresses have?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 different last names do the actors and actresses have?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT last_name) FROM actor
Count the number of different last names actors have.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of different last names actors have.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT last_name) FROM actor
What is the most popular first name of the actors?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 most popular first name of the actors?` to a syntactically-correct PostgreSQL query.
SELECT first_name FROM actor GROUP BY first_name ORDER BY count(*) DESC LIMIT 1
Return the most common first name among all actors.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the most common first name among all actors.` to a syntactically-correct PostgreSQL query.
SELECT first_name FROM actor GROUP BY first_name ORDER BY count(*) DESC LIMIT 1
What is the most popular full name of the actors?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 most popular full name of the actors?` to a syntactically-correct PostgreSQL query.
SELECT first_name , last_name FROM actor GROUP BY first_name , last_name ORDER BY count(*) DESC LIMIT 1
Return the most common full name among all actors.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the most common full name among all actors.` to a syntactically-correct PostgreSQL query.
SELECT first_name , last_name FROM actor GROUP BY first_name , last_name ORDER BY count(*) DESC LIMIT 1
Which districts have at least two addresses?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which districts have at least two addresses?` to a syntactically-correct PostgreSQL query.
SELECT district FROM address GROUP BY district HAVING count(*) >= 2
Give the districts which have two or more addresses.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Give the districts which have two or more addresses.` to a syntactically-correct PostgreSQL query.
SELECT district FROM address GROUP BY district HAVING count(*) >= 2
What is the phone number and postal code of the address 1031 Daugavpils Parkway?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 phone number and postal code of the address 1031 Daugavpils Parkway?` to a syntactically-correct PostgreSQL query.
SELECT phone , postal_code FROM address WHERE address = '1031 Daugavpils Parkway'
Give the phone and postal code corresponding to the address '1031 Daugavpils Parkway'.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Give the phone and postal code corresponding to the address '1031 Daugavpils Parkway'.` to a syntactically-correct PostgreSQL query.
SELECT phone , postal_code FROM address WHERE address = '1031 Daugavpils Parkway'
Which city has the most addresses? List the city name, number of addresses, and city id.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which city has the most addresses? List the city name, number of addresses, and city id.` to a syntactically-correct PostgreSQL query.
SELECT T2.city , count(*) , T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY count(*) DESC LIMIT 1
What are the city name, id, and number of addresses corresponding to the city with the most addressed?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 city name, id, and number of addresses corresponding to the city with the most addressed?` to a syntactically-correct PostgreSQL query.
SELECT T2.city , count(*) , T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY count(*) DESC LIMIT 1
How many addresses are in the district of California?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 addresses are in the district of California?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM address WHERE district = 'California'
Count the number of addressed in the California district.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of addressed in the California district.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM address WHERE district = 'California'
Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id.` to a syntactically-correct PostgreSQL query.
SELECT title , film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING count(*) < 3
What are the title and id of the film which has a rental rate of 0.99 and an inventory of below 3?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 title and id of the film which has a rental rate of 0.99 and an inventory of below 3?` to a syntactically-correct PostgreSQL query.
SELECT title , film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING count(*) < 3
How many cities are in Australia?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 cities are in Australia?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'
Count the number of cities in Australia.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of cities in Australia.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'
Which countries have at least 3 cities?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which countries have at least 3 cities?` to a syntactically-correct PostgreSQL query.
SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING count(*) >= 3
What are the countries that contain 3 or more cities?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 countries that contain 3 or more cities?` to a syntactically-correct PostgreSQL query.
SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING count(*) >= 3
Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa.` to a syntactically-correct PostgreSQL query.
SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'
What are the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?` to a syntactically-correct PostgreSQL query.
SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'
How many customers have an active value of 1?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 customers have an active value of 1?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customer WHERE active = '1'
Count the number of customers who are active.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of customers who are active.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM customer WHERE active = '1'
Which film has the highest rental rate? And what is the rate?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which film has the highest rental rate? And what is the rate?` to a syntactically-correct PostgreSQL query.
SELECT title , rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1
What are the title and rental rate of the film with the highest rental rate?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 title and rental rate of the film with the highest rental rate?` to a syntactically-correct PostgreSQL query.
SELECT title , rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1
Which film has the most number of actors or actresses? List the film name, film id and description.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which film has the most number of actors or actresses? List the film name, film id and description.` to a syntactically-correct PostgreSQL query.
SELECT T2.title , T2.film_id , T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY count(*) DESC LIMIT 1
What are the title, id, and description of the movie with the greatest number of actors?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 title, id, and description of the movie with the greatest number of actors?` to a syntactically-correct PostgreSQL query.
SELECT T2.title , T2.film_id , T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY count(*) DESC LIMIT 1
Which film actor (actress) starred the most films? List his or her first name, last name and actor id.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which film actor (actress) starred the most films? List his or her first name, last name and actor id.` to a syntactically-correct PostgreSQL query.
SELECT T2.first_name , T2.last_name , T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY count(*) DESC LIMIT 1
Return the full name and id of the actor or actress who starred in the greatest number of films.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the full name and id of the actor or actress who starred in the greatest number of films.` to a syntactically-correct PostgreSQL query.
SELECT T2.first_name , T2.last_name , T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY count(*) DESC LIMIT 1
Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name.` to a syntactically-correct PostgreSQL query.
SELECT T2.first_name , T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING count(*) > 30
What are the full names of actors who had roles in more than 30 films?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 full names of actors who had roles in more than 30 films?` to a syntactically-correct PostgreSQL query.
SELECT T2.first_name , T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING count(*) > 30
Which store owns most items?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which store owns most items?` to a syntactically-correct PostgreSQL query.
SELECT store_id FROM inventory GROUP BY store_id ORDER BY count(*) DESC LIMIT 1
What is the id of the store that has the most items in inventory?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 store that has the most items in inventory?` to a syntactically-correct PostgreSQL query.
SELECT store_id FROM inventory GROUP BY store_id ORDER BY count(*) DESC LIMIT 1
What is the total amount of all payments?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 amount of all payments?` to a syntactically-correct PostgreSQL query.
SELECT sum(amount) FROM payment
Return the sum of all payment amounts.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the sum of all payment amounts.` to a syntactically-correct PostgreSQL query.
SELECT sum(amount) FROM payment
Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.` to a syntactically-correct PostgreSQL query.
SELECT T1.first_name , T1.last_name , T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) ASC LIMIT 1
What is the full name and id of the customer who has the lowest total amount of payment?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 full name and id of the customer who has the lowest total amount of payment?` to a syntactically-correct PostgreSQL query.
SELECT T1.first_name , T1.last_name , T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) ASC LIMIT 1
What is the genre name of the film HUNGER ROOF?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 genre name of the film HUNGER ROOF?` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'
Return the name of the category to which the film 'HUNGER ROOF' belongs.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the name of the category to which the film 'HUNGER ROOF' belongs.` to a syntactically-correct PostgreSQL query.
SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'
How many films are there in each category? List the genre name, genre id and the count.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 films are there in each category? List the genre name, genre id and the count.` to a syntactically-correct PostgreSQL query.
SELECT T2.name , T1.category_id , count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id
What are the names and ids of the different categories, and how many films are in each?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 and ids of the different categories, and how many films are in each?` to a syntactically-correct PostgreSQL query.
SELECT T2.name , T1.category_id , count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id
Which film has the most copies in the inventory? List both title and id.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which film has the most copies in the inventory? List both title and id.` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY count(*) DESC LIMIT 1
What is the title and id of the film that has the greatest number of copies in inventory?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 and id of the film that has the greatest number of copies in inventory?` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY count(*) DESC LIMIT 1
What is the film title and inventory id of the item in the inventory which was rented most frequently?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 film title and inventory id of the item in the inventory which was rented most frequently?` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY count(*) DESC LIMIT 1
Return the title and inventory id of the film that is rented most often.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the title and inventory id of the film that is rented most often.` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY count(*) DESC LIMIT 1
How many languages are in these films?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 languages are in these films?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT language_id) FROM film
Count the number of different languages in these films.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of different languages in these films.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT language_id) FROM film
What are all the movies rated as R? List the titles.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 all the movies rated as R? List the titles.` to a syntactically-correct PostgreSQL query.
SELECT title FROM film WHERE rating = 'R'
Return the titles of any movies with an R rating.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the titles of any movies with an R rating.` to a syntactically-correct PostgreSQL query.
SELECT title FROM film WHERE rating = 'R'
Where is store 1 located?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Where is store 1 located?` to a syntactically-correct PostgreSQL query.
SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1
Return the address of store 1.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the address of store 1.` to a syntactically-correct PostgreSQL query.
SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1
Which staff handled least number of payments? List the full name and the id.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which staff handled least number of payments? List the full name and the id.` to a syntactically-correct PostgreSQL query.
SELECT T1.first_name , T1.last_name , T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) ASC LIMIT 1
Give the full name and staff id of the staff who has handled the fewest payments.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Give the full name and staff id of the staff who has handled the fewest payments.` to a syntactically-correct PostgreSQL query.
SELECT T1.first_name , T1.last_name , T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) ASC LIMIT 1
Which language does the film AIRPORT POLLOCK use? List the language name.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which language does the film AIRPORT POLLOCK use? List the language name.` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'
What is the name of the language that the film 'AIRPORT POLLOCK' is in?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 language that the film 'AIRPORT POLLOCK' is in?` to a syntactically-correct PostgreSQL query.
SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'
How many stores are there?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 stores are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM store
Count the number of stores.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of stores.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM store
How many kinds of different ratings are listed?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 kinds of different ratings are listed?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT rating) FROM film
Count the number of different film ratings.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of different film ratings.` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT rating) FROM film
Which movies have 'Deleted Scenes' as a substring in the special feature?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which movies have 'Deleted Scenes' as a substring in the special feature?` to a syntactically-correct PostgreSQL query.
SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'
Return the titles of films that include 'Deleted Scenes' in their special feature section.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the titles of films that include 'Deleted Scenes' in their special feature section.` to a syntactically-correct PostgreSQL query.
SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'
How many items in inventory does store 1 have?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 items in inventory does store 1 have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM inventory WHERE store_id = 1
Count the number of items store 1 has in stock.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Count the number of items store 1 has in stock.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM inventory WHERE store_id = 1
When did the first payment happen?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `When did the first payment happen?` to a syntactically-correct PostgreSQL query.
SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1
What was the date of the earliest payment?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 was the date of the earliest payment?` to a syntactically-correct PostgreSQL query.
SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1
Where does the customer with the first name Linda live? And what is her email?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Where does the customer with the first name Linda live? And what is her email?` to a syntactically-correct PostgreSQL query.
SELECT T2.address , T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'
Return the address and email of the customer with the first name Linda.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the address and email of the customer with the first name Linda.` to a syntactically-correct PostgreSQL query.
SELECT T2.address , T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'
Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles.` to a syntactically-correct PostgreSQL query.
SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200
What are the titles of films that are either longer than 100 minutes or rated PG other than those that cost more than 200 to replace?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 films that are either longer than 100 minutes or rated PG other than those that cost more than 200 to replace?` to a syntactically-correct PostgreSQL query.
SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200
What is the first name and the last name of the customer who made the earliest rental?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 first name and the last name of the customer who made the earliest rental?` to a syntactically-correct PostgreSQL query.
SELECT T1.first_name , T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1
Return the full name of the customer who made the first rental.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the full name of the customer who made the first rental.` to a syntactically-correct PostgreSQL query.
SELECT T1.first_name , T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1
What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 full name of the staff member who has rented a film to a customer with the first name April and the last name Burns?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.first_name , T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'
Return the full name of the staff who provided a customer with the first name April and the last name Burns with a film rental.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the full name of the staff who provided a customer with the first name April and the last name Burns with a film rental.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.first_name , T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'
Which store has most the customers?
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 `Which store has most the customers?` to a syntactically-correct PostgreSQL query.
SELECT store_id FROM customer GROUP BY store_id ORDER BY count(*) DESC LIMIT 1
Return the id of the store with the most customers.
-- Language PostgreSQL -- Tables: -- Table: actor columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']] -- Table: address columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']] -- Table: category columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: city columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']] -- Table: country columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']] -- Table: customer columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']] -- Table: film columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']] -- Table: film actor columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']] -- Table: film category columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']] -- Table: film text columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']] -- Table: inventory columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']] -- Table: language columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']] -- Table: payment columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']] -- Table: rental columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']] -- Table: staff columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']] -- Table: store columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', '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 the id of the store with the most customers.` to a syntactically-correct PostgreSQL query.
SELECT store_id FROM customer GROUP BY store_id ORDER BY count(*) DESC LIMIT 1