sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 people that have been comptroller the most times and the corresponding number of times.
SQL: SELECT Comptroller ,  COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 people severed as comptroller most frequently? Give me the name of the person and the frequency count.
SQL: SELECT Comptroller ,  COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 parties that do not have delegates in election?
SQL: SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election)
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 parties did not have any delegates in elections?
SQL: SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election)
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 parties that have both delegates on "Appropriations" committee and
SQL: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Economic Matters"
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 parties have delegates in both the "Appropriations" committee and the "Economic Matters" committee?
SQL: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Economic Matters"
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 committees have delegates from both democratic party and liberal party?
SQL: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Liberal"
-- Language PostgreSQL
        -- Tables: 
             -- Table: county 
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]

 -- Table: party 
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]

 -- Table: election 
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 committees that have delegates both from from the democratic party and the liberal party.
SQL: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Liberal"
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 journalists are there?
SQL: SELECT count(*) FROM journalist
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists in ascending order of years working.
SQL: SELECT Name FROM journalist ORDER BY Years_working ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 nationalities and ages of journalists?
SQL: SELECT Nationality ,  Age FROM journalist
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists from "England" or "Wales".
SQL: SELECT Name FROM journalist WHERE Nationality  =  "England" OR Nationality  =  "Wales"
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 number of years spent working as a journalist?
SQL: SELECT avg(Years_working) FROM journalist
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 nationality of the journalist with the largest number of years working?
SQL: SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 different nationalities and the number of journalists of each nationality.
SQL: SELECT Nationality ,  COUNT(*) FROM journalist GROUP BY Nationality
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 most common nationality for journalists.
SQL: SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.
SQL: SELECT Nationality FROM journalist WHERE Years_working  >  10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working  <  3
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 dates, places, and names of events in descending order of the attendance.
SQL: SELECT Date ,  Name ,  venue FROM event ORDER BY Event_Attendance DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists and the dates of the events they reported.
SQL: SELECT T3.Name ,  T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists and the names of the events they reported in ascending order
SQL: SELECT T3.Name ,  T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID ORDER BY T2.Event_Attendance ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists and the number of events they reported.
SQL: SELECT T3.Name ,  COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID GROUP BY T3.Name
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists that have reported more than one event.
SQL: SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID  =  T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID  =  T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*)  >  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 names of journalists who have not reported any event.
SQL: SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report)
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 and maximum attendances of all events?
SQL: SELECT avg(Event_Attendance) ,  max(Event_Attendance) FROM event
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 age and experience working length of journalists working on different role type.
SQL: SELECT avg(t1.age) ,  avg(Years_working) ,  t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id  =  t2.journalist_id GROUP BY t2.work_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: event 
columns : [['event id', 'number'], ['date', 'text'], ['venue', 'text'], ['name', 'text'], ['event attendance', 'number']]

 -- Table: journalist 
columns : [['journalist id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text'], ['years working', 'number']]

 -- Table: news report 
columns : [['journalist id', 'number'], ['event id', 'number'], ['work type', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the 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 event venues and names that have the top 2 most number of people attended.
SQL: SELECT venue ,  name FROM event ORDER BY Event_Attendance DESC LIMIT 2
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 me all the restaurants.
SQL: SELECT ResName FROM Restaurant;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 address of the restaurant Subway?
SQL: SELECT Address FROM Restaurant WHERE ResName = "Subway";
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 rating of the restaurant Subway?
SQL: SELECT Rating FROM Restaurant WHERE ResName = "Subway";
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 restaurant types.
SQL: SELECT ResTypeName FROM Restaurant_Type;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 description of the restaurant type Sandwich?
SQL: SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = "Sandwich";
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 restaurants have highest rating? List the restaurant name and its rating.
SQL: SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 age of student Linda Smith?
SQL: SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 gender of the student Linda Smith?
SQL: SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 students' first names and last names who majored in 600.
SQL: SELECT Fname , Lname FROM Student WHERE Major  =  600;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 city does student Linda Smith live in?
SQL: SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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: Advisor 1121 has how many students?
SQL: SELECT count(*) FROM Student WHERE Advisor =  1121;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 Advisor has most of students? List advisor and the number of students.
SQL: SELECT Advisor ,  count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 major has least number of students? List the major and the number of students.
SQL: SELECT Major ,  count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 major has between 2 and 30 number of students? List major and the number of students.
SQL: SELECT Major ,  count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 student's age is older than 18 and is majoring in 600? List each student's first and last name.
SQL: SELECT Fname , Lname FROM Student WHERE Age  >  18 AND Major = 600;
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 female students age is older than 18 who is not majoring in 600. List students' first name and last name.
SQL: SELECT Fname , Lname FROM Student WHERE Age  >  18 AND Major != 600 AND Sex = 'F';
-- Language PostgreSQL
        -- Tables: 
             -- Table: student 
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]

 -- Table: restaurant 
columns : [['restaurant id', 'number'], ['restaurant name', 'text'], ['address', 'text'], ['rating', 'number']]

 -- Table: type of restaurant 
columns : [['restaurant id', 'number'], ['restaurant type id', 'number']]

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

 -- Table: visits restaurant 
columns : [['student id', 'number'], ['restaurant id', 'number'], ['time', 'time'], ['spent', '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 restaurant is the Sandwich type restaurant?
SQL: SELECT count(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID =  Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'