sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show theme and year for all exhibitions with ticket prices lower than 15.
SQL: SELECT theme ,  YEAR FROM exhibition WHERE ticket_price  <  15
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 theme and year for all exhibitions that have a ticket price under 15?
SQL: SELECT theme ,  YEAR FROM exhibition WHERE ticket_price  <  15
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show all artist names and the number of exhibitions for each artist.
SQL: SELECT T2.name ,  count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id GROUP BY T1.artist_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 exhibitions has each artist had?
SQL: SELECT T2.name ,  count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id GROUP BY T1.artist_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 name and country for the artist with most number of exhibitions?
SQL: SELECT T2.name , T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 name and country corresponding to the artist who has had the most exhibitions.
SQL: SELECT T2.name , T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show names for artists without any exhibition.
SQL: SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition)
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 names of artists that have not had any exhibitions?
SQL: SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition)
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 theme and artist name for the exhibition with a ticket price higher than the average?
SQL: SELECT T1.theme ,  T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.ticket_price  >  (SELECT avg(ticket_price) FROM exhibition)
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 names of artists and the themes of their exhibitions that had a ticket price higher than average.
SQL: SELECT T1.theme ,  T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.ticket_price  >  (SELECT avg(ticket_price) FROM exhibition)
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009.
SQL: SELECT avg(ticket_price) ,  min(ticket_price) ,  max(ticket_price) FROM exhibition WHERE YEAR  <  2009
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 average, minimum, and maximum ticket prices for exhibitions that happened prior to 2009?
SQL: SELECT avg(ticket_price) ,  min(ticket_price) ,  max(ticket_price) FROM exhibition WHERE YEAR  <  2009
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show theme and year for all exhibitions in an descending order of ticket price.
SQL: SELECT theme ,  YEAR FROM exhibition ORDER BY ticket_price DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 themes and years for exhibitions, sorted by ticket price descending?
SQL: SELECT theme ,  YEAR FROM exhibition ORDER BY ticket_price DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 theme, date, and attendance for the exhibition in year 2004?
SQL: SELECT T2.theme ,  T1.date ,  T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T2.year  =  2004
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 themes, dates, and attendance for exhibitions that happened in 2004.
SQL: SELECT T2.theme ,  T1.date ,  T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T2.year  =  2004
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show all artist names who didn't have an exhibition in 2004.
SQL: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.year  =  2004
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 names of artists who did not have an exhibition in 2004?
SQL: SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id  =  T2.artist_id WHERE T1.year  =  2004
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show the theme for exhibitions with both records of an attendance below 100 and above 500.
SQL: SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  <  100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  500
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 themes have had corresponding exhibitions that have had attendance both below 100 and above 500?
SQL: SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  <  100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  500
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 exhibitions have a attendance more than 100 or have a ticket price below 10?
SQL: SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  100 OR T2.ticket_price  <  10
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Count the number of exhibitions that have had an attendnance of over 100 or a ticket prices under 10.
SQL: SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id WHERE T1.attendance  >  100 OR T2.ticket_price  <  10
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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: Show all artist names with an average exhibition attendance over 200.
SQL: SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id JOIN artist AS T3 ON T3.artist_id  =  T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance)  >  200
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 names of artist whose exhibitions draw over 200 attendees on average?
SQL: SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id  =  T2.exhibition_id JOIN artist AS T3 ON T3.artist_id  =  T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance)  >  200
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 id of the item whose title is "orange".
SQL: SELECT i_id FROM item WHERE title  =  "orange"
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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: List all information in the item table.
SQL: SELECT * FROM item
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 number of reviews.
SQL: SELECT count(*) FROM review
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 users are there?
SQL: SELECT count(*) FROM useracct
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 and maximum rating of all reviews.
SQL: SELECT avg(rating) ,  max(rating) FROM review
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 highest rank of all reviews.
SQL: SELECT min(rank) FROM review
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 different users wrote some reviews?
SQL: SELECT count(DISTINCT u_id) FROM review
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 different items were reviewed by some users?
SQL: SELECT count(DISTINCT i_id) FROM review
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 number of items that did not receive any review.
SQL: SELECT count(*) FROM item WHERE i_id NOT IN (SELECT i_id FROM review)
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 names of users who did not leave any review.
SQL: SELECT name FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 names of goods that receive a rating of 10.
SQL: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  =  10
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 items whose rating is higher than the average review rating of all items.
SQL: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  >  (SELECT avg(rating) FROM review)
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 items that received any rating below 5.
SQL: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  <  5
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 items that received both a rating higher than 8 and a rating below 5.
SQL: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  >  8 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rating  <  5
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 names of items whose rank is higher than 3 and whose average rating is above 5.
SQL: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id WHERE T2.rank  >  3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id HAVING avg(T2.rating)  >  5
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 the item with the lowest average rating.
SQL: SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rating) LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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: List the titles of all items in alphabetic order .
SQL: SELECT title FROM item ORDER BY title
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 the user who gives the most reviews.
SQL: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id GROUP BY T2.u_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 and id of the item with the highest average rating.
SQL: SELECT T1.title ,  T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rating) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 and id of the good with the highest average rank.
SQL: SELECT T1.title ,  T1.i_id FROM item AS T1 JOIN review AS T2 ON T1.i_id  =  T2.i_id GROUP BY T2.i_id ORDER BY avg(T2.rank) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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: For each user, return the name and the average rating of reviews given by them.
SQL: SELECT T1.name ,  avg(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id GROUP BY T2.u_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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: For each user, find their name and the number of reviews written by them.
SQL: SELECT T1.name ,  count(*) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id GROUP BY T2.u_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 the user who gave the highest rating.
SQL: SELECT T1.name FROM useracct AS T1 JOIN review AS T2 ON T1.u_id  =  T2.u_id ORDER BY T2.rating DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 the source user with the highest average trust score.
SQL: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id  =  T2.source_u_id GROUP BY T2.source_u_id ORDER BY avg(trust) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 each target user's name and average trust score.
SQL: SELECT T1.name ,  avg(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id  =  T2.target_u_id GROUP BY T2.target_u_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: item 
columns : [['item id', 'number'], ['title', 'text']]

 -- Table: review 
columns : [['a id', 'number'], ['user id', 'number'], ['item id', 'number'], ['rating', 'number'], ['rank', 'number']]

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

 -- Table: trust 
columns : [['source user id', 'number'], ['target user id', 'number'], ['trust', '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 the target user with the lowest trust score.
SQL: SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id  =  T2.target_u_id ORDER BY trust LIMIT 1