sert121/SpiderSQL huggingface dataset:
-- 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.



Question: Which paper's title contains the word "Database"?
SQL: SELECT title FROM papers WHERE title LIKE "%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.



Question: Which papers have the substring "Database" in their titles? Show the titles of the papers.
SQL: SELECT title FROM papers WHERE title LIKE "%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.



Question: Find the first names of all the authors who have written a paper with title containing the word "Functional".
SQL: 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%"
-- 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.



Question: Who has written a paper that has the word "Functional" in its title? Return the first names of the authors.
SQL: 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%"
-- 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.



Question: Find the last names of all the authors that have written a paper with title containing the word "Monadic".
SQL: 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%"
-- 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.



Question: Which authors have written a paper with title containing the word "Monadic"? Return their last names.
SQL: 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%"
-- 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.



Question: Retrieve the title of the paper that has the largest number of authors.
SQL: SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid  =  t2.paperid WHERE t1.authorder  =  (SELECT max(authorder) FROM authorship)
-- 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.



Question: Which paper has the most authors? Give me the paper title.
SQL: SELECT t2.title FROM authorship AS t1 JOIN papers AS t2 ON t1.paperid  =  t2.paperid WHERE t1.authorder  =  (SELECT max(authorder) FROM authorship)
-- 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.



Question: What is the first name of the author with last name "Ueno"?
SQL: SELECT fname FROM authors WHERE lname  =  "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.



Question: Which authors have last name "Ueno"? List their first names.
SQL: SELECT fname FROM authors WHERE lname  =  "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.



Question: Find the last name of the author with first name "Amal".
SQL: SELECT lname FROM authors WHERE fname  =  "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.



Question: Which authors have first name "Amal"? List their last names.
SQL: SELECT lname FROM authors WHERE fname  =  "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.



Question: Find the first names of all the authors ordered in alphabetical order.
SQL: SELECT fname FROM authors ORDER BY fname
-- 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.



Question: Sort the first names of all the authors in alphabetical order.
SQL: SELECT fname FROM authors ORDER BY fname
-- 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.



Question: Retrieve all the last names of authors in alphabetical order.
SQL: SELECT lname FROM authors ORDER BY lname
-- 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.



Question: Give me a list of all the last names of authors sorted in alphabetical order
SQL: SELECT lname FROM authors ORDER BY lname
-- 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.



Question: Retrieve all the first and last names of authors in the alphabetical order of last names.
SQL: SELECT fname ,  lname FROM authors ORDER BY lname
-- 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.



Question: Sort the list of all the first and last names of authors in alphabetical order of the last names.
SQL: SELECT fname ,  lname FROM authors ORDER BY lname
-- 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.



Question: How many different last names do the actors and actresses have?
SQL: SELECT count(DISTINCT last_name) FROM actor
-- 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.



Question: Count the number of different last names actors have.
SQL: SELECT count(DISTINCT last_name) FROM actor
-- 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.



Question: Which districts have at least two addresses?
SQL: SELECT district FROM address GROUP BY district HAVING count(*)  >=  2
-- 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.



Question: Give the districts which have two or more addresses.
SQL: SELECT district FROM address GROUP BY district HAVING count(*)  >=  2
-- 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.



Question: How many addresses are in the district of California?
SQL: SELECT count(*) FROM address WHERE district  =  '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.



Question: Count the number of addressed in the California district.
SQL: SELECT count(*) FROM address WHERE district  =  '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.



Question: How many customers have an active value of 1?
SQL: SELECT count(*) FROM customer WHERE active = '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.



Question: Count the number of customers who are active.
SQL: SELECT count(*) FROM customer WHERE active = '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.



Question: Which store owns most items?
SQL: SELECT store_id FROM inventory GROUP BY store_id ORDER BY count(*) DESC LIMIT 1