sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 average unit price of rock tracks?
SQL: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Rock"
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 average unit price of tracks from the Rock genre.
SQL: SELECT AVG(T2.UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Rock"
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are the duration of the longest and shortest pop tracks in milliseconds?
SQL: SELECT max(Milliseconds) ,  min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Pop"
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 maximum and minimum millisecond lengths of pop tracks.
SQL: SELECT max(Milliseconds) ,  min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId  =  T2.GenreId WHERE T1.Name  =  "Pop"
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are the birth dates of employees living in Edmonton?
SQL: SELECT BirthDate FROM EMPLOYEE WHERE City  =  "Edmonton"
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 birth dates corresponding to employees who live in the city of Edmonton.
SQL: SELECT BirthDate FROM EMPLOYEE WHERE City  =  "Edmonton"
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are the distinct unit prices of all tracks?
SQL: SELECT distinct(UnitPrice) FROM TRACK
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 distinct unit prices for tracks.
SQL: SELECT distinct(UnitPrice) FROM TRACK
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 artists do not have any album?
SQL: SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM)
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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: Cound the number of artists who have not released an album.
SQL: SELECT count(*) FROM ARTIST WHERE artistid NOT IN(SELECT artistid FROM ALBUM)
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are the album titles for albums containing both 'Reggae' and 'Rock' genre tracks?
SQL: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Rock'
-- Language PostgreSQL
        -- Tables: 
             -- Table: album 
columns : [['album id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text']]

 -- Table: customer 
columns : [['customer id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support representative id', 'number']]

 -- Table: employee 
columns : [['employee id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: genre 
columns : [['genre id', 'number'], ['name', 'text']]

 -- Table: invoice 
columns : [['invoice id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: invoice line 
columns : [['invoice line id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: media type 
columns : [['media type id', 'number'], ['name', 'text']]

 -- Table: playlist 
columns : [['play list id', 'number'], ['name', 'text']]

 -- Table: playlist track 
columns : [['play list id', 'number'], ['track id', 'number']]

 -- Table: track 
columns : [['track id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 titles of albums that contain tracks of both the Reggae and Rock genres.
SQL: SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Reggae' INTERSECT SELECT T1.Title FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId  =  T2.AlbumId JOIN Genre AS T3 ON T2.GenreID  =  T3.GenreID WHERE T3.Name  =  'Rock'
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 all the phone numbers.
SQL: SELECT customer_phone FROM available_policies
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are all the phone numbers?
SQL: SELECT customer_phone FROM available_policies
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are the customer phone numbers under the policy "Life Insurance"?
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  "Life Insurance"
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are the phone numbers of customers using the policy with the code "Life Insurance"?
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  "Life Insurance"
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 policy type has the most records in the database?
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 policy type appears most frequently in the available policies?
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 are all the customer phone numbers under the most popular policy type?
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1)
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 phone numbers of customers using the most common policy type among the available policies.
SQL: SELECT customer_phone FROM available_policies WHERE policy_type_code  =  (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1)
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 policy type used by more than 4 customers.
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*)  >  4
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 policy types more than 4 customers use. Show their type code.
SQL: SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*)  >  4
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 total and average amount of settlements.
SQL: SELECT sum(settlement_amount) ,  avg(settlement_amount) FROM settlements
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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: Return the sum and average of all settlement amounts.
SQL: SELECT sum(settlement_amount) ,  avg(settlement_amount) FROM settlements
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer name', 'text']]

 -- Table: services 
columns : [['service id', 'number'], ['service name', 'text']]

 -- Table: available policies 
columns : [['policy id', 'number'], ['policy type code', 'text'], ['customer phone', 'text']]

 -- Table: customers policies 
columns : [['customer id', 'number'], ['policy id', 'number'], ['date opened', 'time'], ['date closed', 'time']]

 -- Table: first notification of loss 
columns : [['fnol id', 'number'], ['customer id', 'number'], ['policy id', 'number'], ['service id', 'number']]

 -- Table: claims 
columns : [['claim id', 'number'], ['fnol id', 'number'], ['effective date', 'time']]

 -- Table: settlements 
columns : [['settlement id', 'number'], ['claim id', 'number'], ['effective date', 'time'], ['settlement amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 name of services that have been used for more than 2 times in first notification of loss.
SQL: SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id  =  t2.service_id GROUP BY t1.service_id HAVING count(*)  >  2