brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
Which committees have delegates from both democratic party and liberal party? |
-- 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.
Translate `Which committees have delegates from both democratic party and liberal party?` to a syntactically-correct PostgreSQL query.
| 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" |
Find the committees that have delegates both from from the democratic party and the liberal party. |
-- 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.
Translate `Find the committees that have delegates both from from the democratic party and the liberal party.` to a syntactically-correct PostgreSQL query.
| 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" |
How many journalists are there? |
-- 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.
Translate `How many journalists are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM journalist |
List the names of journalists in ascending order of years working. |
-- 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.
Translate `List the names of journalists in ascending order of years working.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM journalist ORDER BY Years_working ASC |
What are the nationalities and ages of journalists? |
-- 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.
Translate `What are the nationalities and ages of journalists?` to a syntactically-correct PostgreSQL query.
| SELECT Nationality , Age FROM journalist |
Show the names of journalists from "England" or "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.
Translate `Show the names of journalists from "England" or "Wales".` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM journalist WHERE Nationality = "England" OR Nationality = "Wales" |
What is the average number of years spent working as a 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.
Translate `What is the average number of years spent working as a journalist?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Years_working) FROM journalist |
What is the nationality of the journalist with the largest number of years working? |
-- 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.
Translate `What is the nationality of the journalist with the largest number of years working?` to a syntactically-correct PostgreSQL query.
| SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1 |
Show the different nationalities and the number of journalists of each 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.
Translate `Show the different nationalities and the number of journalists of each nationality.` to a syntactically-correct PostgreSQL query.
| SELECT Nationality , COUNT(*) FROM journalist GROUP BY Nationality |
Show the most common nationality for journalists. |
-- 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.
Translate `Show the most common nationality for journalists.` to a syntactically-correct PostgreSQL query.
| SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1 |
Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working. |
-- 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.
Translate `Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.` to a syntactically-correct PostgreSQL query.
| SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3 |
Show the dates, places, and names of events in descending order of the attendance. |
-- 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.
Translate `Show the dates, places, and names of events in descending order of the attendance.` to a syntactically-correct PostgreSQL query.
| SELECT Date , Name , venue FROM event ORDER BY Event_Attendance DESC |
Show the names of journalists and the dates of the events they reported. |
-- 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.
Translate `Show the names of journalists and the dates of the events they reported.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of journalists and the names of the events they reported in ascending order |
-- 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.
Translate `Show the names of journalists and the names of the events they reported in ascending order` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of journalists and the number of events they reported. |
-- 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.
Translate `Show the names of journalists and the number of events they reported.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the names of journalists that have reported more than one 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.
Translate `Show the names of journalists that have reported more than one event.` to a syntactically-correct PostgreSQL query.
| 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 |
List the names of journalists who have not reported any 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.
Translate `List the names of journalists who have not reported any event.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report) |
what are the average and maximum attendances of all events? |
-- 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.
Translate `what are the average and maximum attendances of all events?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Event_Attendance) , max(Event_Attendance) FROM event |
Find the average age and experience working length of journalists working on different role 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.
Translate `Find the average age and experience working length of journalists working on different role type.` to a syntactically-correct PostgreSQL query.
| 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 |
List the event venues and names that have the top 2 most number of people attended. |
-- 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.
Translate `List the event venues and names that have the top 2 most number of people attended.` to a syntactically-correct PostgreSQL query.
| SELECT venue , name FROM event ORDER BY Event_Attendance DESC LIMIT 2 |
Show me all the restaurants. |
-- 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.
Translate `Show me all the restaurants.` to a syntactically-correct PostgreSQL query.
| SELECT ResName FROM Restaurant; |
What is the address of the restaurant 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.
Translate `What is the address of the restaurant Subway?` to a syntactically-correct PostgreSQL query.
| SELECT Address FROM Restaurant WHERE ResName = "Subway"; |
What is the rating of the restaurant 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.
Translate `What is the rating of the restaurant Subway?` to a syntactically-correct PostgreSQL query.
| SELECT Rating FROM Restaurant WHERE ResName = "Subway"; |
List all restaurant types. |
-- 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.
Translate `List all restaurant types.` to a syntactically-correct PostgreSQL query.
| SELECT ResTypeName FROM Restaurant_Type; |
What is the description of the restaurant type 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.
Translate `What is the description of the restaurant type Sandwich?` to a syntactically-correct PostgreSQL query.
| SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = "Sandwich"; |
Which restaurants have highest rating? List the restaurant name and its rating. |
-- 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.
Translate `Which restaurants have highest rating? List the restaurant name and its rating.` to a syntactically-correct PostgreSQL query.
| SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1; |
What is the age of student Linda 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.
Translate `What is the age of student Linda Smith?` to a syntactically-correct PostgreSQL query.
| SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith"; |
What is the gender of the student Linda 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.
Translate `What is the gender of the student Linda Smith?` to a syntactically-correct PostgreSQL query.
| SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith"; |
List all students' first names and last names who majored in 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.
Translate `List all students' first names and last names who majored in 600.` to a syntactically-correct PostgreSQL query.
| SELECT Fname , Lname FROM Student WHERE Major = 600; |
Which city does student Linda Smith live in? |
-- 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.
Translate `Which city does student Linda Smith live in?` to a syntactically-correct PostgreSQL query.
| SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith"; |
Advisor 1121 has how many students? |
-- 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.
Translate `Advisor 1121 has how many students?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Student WHERE Advisor = 1121; |
Which Advisor has most of students? List advisor and the number of students. |
-- 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.
Translate `Which Advisor has most of students? List advisor and the number of students.` to a syntactically-correct PostgreSQL query.
| SELECT Advisor , count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1; |
Which major has least number of students? List the major and the number of students. |
-- 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.
Translate `Which major has least number of students? List the major and the number of students.` to a syntactically-correct PostgreSQL query.
| SELECT Major , count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1; |
Which major has between 2 and 30 number of students? List major and the number of students. |
-- 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.
Translate `Which major has between 2 and 30 number of students? List major and the number of students.` to a syntactically-correct PostgreSQL query.
| SELECT Major , count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30; |
Which student's age is older than 18 and is majoring in 600? List each student's first and last name. |
-- 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.
Translate `Which student's age is older than 18 and is majoring in 600? List each student's first and last name.` to a syntactically-correct PostgreSQL query.
| SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major = 600; |
List all female students age is older than 18 who is not majoring in 600. List students' first name and last name. |
-- 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.
Translate `List all female students age is older than 18 who is not majoring in 600. List students' first name and last name.` to a syntactically-correct PostgreSQL query.
| SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F'; |
How many restaurant is the Sandwich type 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.
Translate `How many restaurant is the Sandwich type restaurant?` to a syntactically-correct PostgreSQL query.
| 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' |
How long does student Linda Smith spend on the restaurant in total? |
-- 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.
Translate `How long does student Linda Smith spend on the restaurant in total?` to a syntactically-correct PostgreSQL query.
| SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith"; |
How many times has the student Linda Smith visited 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.
Translate `How many times has the student Linda Smith visited Subway?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway"; |
When did Linda Smith visit 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.
Translate `When did Linda Smith visit Subway?` to a syntactically-correct PostgreSQL query.
| SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway"; |
At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total. |
-- 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.
Translate `At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.` to a syntactically-correct PostgreSQL query.
| SELECT Restaurant.ResName , sum(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1; |
Which student visited restaurant most often? List student's first name and last name. |
-- 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.
Translate `Which student visited restaurant most often? List student's first name and last name.` to a syntactically-correct PostgreSQL query.
| SELECT Student.Fname , Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY count(*) DESC LIMIT 1; |
Find the ids of orders whose status is 'Success'. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the ids of orders whose status is 'Success'.` to a syntactically-correct PostgreSQL query.
| SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success' |
Find the name and price of the product that has been ordered the greatest number of times. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name and price of the product that has been ordered the greatest number of times.` to a syntactically-correct PostgreSQL query.
| SELECT t1.product_name , t1.product_price FROM products AS t1 JOIN regular_order_products AS t2 ON t1.product_id = t2.product_id GROUP BY t2.product_id ORDER BY count(*) DESC LIMIT 1 |
Find the number of customers in total. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the number of customers in total.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM customers |
How many different payment methods are there? |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many different payment methods are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT payment_method) FROM customers |
Show the details of all trucks in the order of their license number. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the details of all trucks in the order of their license number.` to a syntactically-correct PostgreSQL query.
| SELECT truck_details FROM trucks ORDER BY truck_licence_number |
Find the name of the most expensive product. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the most expensive product.` to a syntactically-correct PostgreSQL query.
| SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1 |
Find the names of customers who are not living in the state of California. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of customers who are not living in the state of California.` to a syntactically-correct PostgreSQL query.
| SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California' |
List the names and emails of customers who payed by Visa card. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the names and emails of customers who payed by Visa card.` to a syntactically-correct PostgreSQL query.
| SELECT customer_email , customer_name FROM customers WHERE payment_method = 'Visa' |
Find the names and phone numbers of customers living in California state. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names and phone numbers of customers living in California state.` to a syntactically-correct PostgreSQL query.
| SELECT t1.customer_name , t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California' |
Find the states which do not have any employee in their record. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the states which do not have any employee in their record.` to a syntactically-correct PostgreSQL query.
| SELECT state_province_county FROM addresses WHERE address_id NOT IN (SELECT employee_address_id FROM Employees) |
List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers.` to a syntactically-correct PostgreSQL query.
| SELECT customer_name , customer_phone , customer_email FROM Customers ORDER BY date_became_customer |
Find the name of the first 5 customers. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the first 5 customers.` to a syntactically-correct PostgreSQL query.
| SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5 |
Find the payment method that is used most frequently. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the payment method that is used most frequently.` to a syntactically-correct PostgreSQL query.
| SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1 |
List the names of all routes in alphabetic order. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the names of all routes in alphabetic order.` to a syntactically-correct PostgreSQL query.
| SELECT route_name FROM Delivery_Routes ORDER BY route_name |
Find the name of route that has the highest number of deliveries. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of route that has the highest number of deliveries.` to a syntactically-correct PostgreSQL query.
| SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY count(*) DESC LIMIT 1 |
List the state names and the number of customers living in each state. |
-- Language PostgreSQL
-- Tables:
-- Table: products
columns : [['product id', 'number'], ['product name', 'text'], ['product price', 'number'], ['product description', 'text']]
-- Table: addresses
columns : [['address id', 'number'], ['address details', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['date became customer', 'time']]
-- Table: regular orders
columns : [['regular order id', 'number'], ['distributer id', 'number']]
-- Table: regular order products
columns : [['regular order id', 'number'], ['product id', 'number']]
-- Table: actual orders
columns : [['actual order id', 'number'], ['order status code', 'text'], ['regular order id', 'number'], ['actual order date', 'time']]
-- Table: actual order products
columns : [['actual order id', 'number'], ['product id', 'number']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['address id', 'number'], ['date from', 'time'], ['address type', 'text'], ['date to', 'time']]
-- Table: delivery routes
columns : [['route id', 'number'], ['route name', 'text'], ['other route details', 'text']]
-- Table: delivery route locations
columns : [['location code', 'text'], ['route id', 'number'], ['location address id', 'number'], ['location name', 'text']]
-- Table: trucks
columns : [['truck id', 'number'], ['truck licence number', 'text'], ['truck details', 'text']]
-- Table: employees
columns : [['employee id', 'number'], ['employee address id', 'number'], ['employee name', 'text'], ['employee phone', 'text']]
-- Table: order deliveries
columns : [['location code', 'text'], ['actual order id', 'number'], ['delivery status code', 'text'], ['driver employee id', 'number'], ['truck id', 'number'], ['delivery date', 'time']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the state names and the number of customers living in each state.` to a syntactically-correct PostgreSQL query.
| SELECT t2.state_province_county , count(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county |
How many authors are there? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many authors are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM authors |
Count the number of authors. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the number of authors.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM authors |
How many institutions are there? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many institutions are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM inst |
Count the number of institutions. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the number of institutions.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM inst |
How many papers are published in total? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many papers are published in total?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM papers |
Count the number of total papers. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the number of total papers.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM papers |
What are the titles of papers published by "Jeremy Gibbons"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the titles of papers published by "Jeremy Gibbons"?` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons" |
Find the titles of all the papers written by "Jeremy Gibbons" |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the titles of all the papers written by "Jeremy Gibbons"` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons" |
Find all the papers published by "Aaron Turon". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find all the papers published by "Aaron Turon".` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon" |
Find the titles of all the papers written by "Aaron Turon". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the titles of all the papers written by "Aaron Turon".` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon" |
How many papers have "Atsushi Ohori" published? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many papers have "Atsushi Ohori" published?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori" |
How many papers are "Atsushi Ohori" the author of? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many papers are "Atsushi Ohori" the author of?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori" |
What is the name of the institution that "Matthias Blume" belongs to? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the institution that "Matthias Blume" belongs to?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume" |
Which institution is the author "Matthias Blume" belong to? Give me the name of the institution. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which institution is the author "Matthias Blume" belong to? Give me the name of the institution.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume" |
Which institution does "Katsuhiro Ueno" belong to? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which institution does "Katsuhiro Ueno" belong to?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno" |
What is the name of the institution the author "Katsuhiro Ueno" belongs to? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the name of the institution the author "Katsuhiro Ueno" belongs to?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno" |
Who belong to the institution "University of Oxford"? Show the first names and last names. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Who belong to the institution "University of Oxford"? Show the first names and last names.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford" |
Find the first names and last names of the authors whose institution affiliation is "University of Oxford". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the first names and last names of the authors whose institution affiliation is "University of Oxford".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford" |
Which authors belong to the institution "Google"? Show the first names and last names. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which authors belong to the institution "Google"? Show the first names and last names.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" |
Find the first names and last names of the authors whose institution affiliation is "Google". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the first names and last names of the authors whose institution affiliation is "Google".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" |
What are the last names of the author of the paper titled "Binders Unbound"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the last names of the author of the paper titled "Binders Unbound"?` to a syntactically-correct PostgreSQL query.
| SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound" |
Who is the author of the paper titled "Binders Unbound"? Give me the last name. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Who is the author of the paper titled "Binders Unbound"? Give me the last name.` to a syntactically-correct PostgreSQL query.
| SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound" |
Find the first and last name of the author(s) who wrote the paper "Nameless, Painless". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the first and last name of the author(s) who wrote the paper "Nameless, Painless".` to a syntactically-correct PostgreSQL query.
| SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless" |
What are the first and last name of the author who published the paper titled "Nameless, Painless"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the first and last name of the author who published the paper titled "Nameless, Painless"?` to a syntactically-correct PostgreSQL query.
| SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless" |
What are the papers published under the institution "Indiana University"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the papers published under the institution "Indiana University"?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University" |
List the titles of the papers whose authors are from the institution "Indiana University". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the titles of the papers whose authors are from the institution "Indiana University".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University" |
Find all the papers published by the institution "Google". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find all the papers published by the institution "Google".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" |
Which papers were written by authors from the institution "Google"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which papers were written by authors from the institution "Google"?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google" |
How many papers are published by the institution "Tokohu University"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many papers are published by the institution "Tokohu University"?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University" |
Find the number of papers published by authors from the institution "Tokohu University". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the number of papers published by authors from the institution "Tokohu University".` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University" |
Find the number of papers published by the institution "University of Pennsylvania". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the number of papers published by the institution "University of Pennsylvania".` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania" |
How many papers are written by authors from the institution "University of Pennsylvania"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many papers are written by authors from the institution "University of Pennsylvania"?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania" |
Find the papers which have "Olin Shivers" as an author. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the papers which have "Olin Shivers" as an author.` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" |
Which papers did the author "Olin Shivers" write? Give me the paper titles. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which papers did the author "Olin Shivers" write? Give me the paper titles.` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers" |
Which papers have "Stephanie Weirich" as an author? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which papers have "Stephanie Weirich" as an author?` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich" |
Find the titles of the papers the author "Stephanie Weirich" wrote. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the titles of the papers the author "Stephanie Weirich" wrote.` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich" |
Which paper is published in an institution in "USA" and have "Turon" as its second author? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which paper is published in an institution in "USA" and have "Turon" as its second author?` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" |
Find papers whose second author has last name "Turon" and is affiliated with an institution in the country "USA". |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find papers whose second author has last name "Turon" and is affiliated with an institution in the country "USA".` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon" |
Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"?` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori" |
Which papers' first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? Give me the titles of the papers. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which papers' first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? Give me the titles of the papers.` to a syntactically-correct PostgreSQL query.
| SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori" |
What is the last name of the author that has published the most papers? |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the last name of the author that has published the most papers?` to a syntactically-correct PostgreSQL query.
| SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1 |
Which author has written the most papers? Find his or her last name. |
-- Language PostgreSQL
-- Tables:
-- Table: institution
columns : [['institution id', 'number'], ['name', 'text'], ['country', 'text']]
-- Table: authors
columns : [['author id', 'number'], ['last name', 'text'], ['first name', 'text']]
-- Table: papers
columns : [['paper id', 'number'], ['title', 'text']]
-- Table: authorship count
columns : [['author id', 'number'], ['institution id', 'number'], ['paper id', 'number'], ['author count', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which author has written the most papers? Find his or her last name.` to a syntactically-correct PostgreSQL query.
| SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.