brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
How many members of "Bootup Baltimore" are older than 18? |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 members of "Bootup Baltimore" are older than 18?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.age > 18 |
Count the number of members in club "Bootup Baltimore" whose age is above 18. |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 `Count the number of members in club "Bootup Baltimore" whose age is above 18.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.age > 18 |
How many members of club "Bootup Baltimore" are younger than 18? |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 members of club "Bootup Baltimore" are younger than 18?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.age < 18 |
Count the number of members in club "Bootup Baltimore" whose age is below 18. |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 `Count the number of members in club "Bootup Baltimore" whose age is below 18.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.age < 18 |
Find the names of all the clubs that have at least a member from the city with city code "BAL". |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 names of all the clubs that have at least a member from the city with city code "BAL".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "BAL" |
Which clubs have one or more members from the city with code "BAL"? Give me the names of the clubs. |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 clubs have one or more members from the city with code "BAL"? Give me the names of the clubs.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "BAL" |
Find the names of the clubs that have at least a member from the city with city code "HOU". |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 names of the clubs that have at least a member from the city with city code "HOU".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "HOU" |
Which clubs have one or more members from the city with code "HOU"? Give me the names of the clubs. |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 clubs have one or more members from the city with code "HOU"? Give me the names of the clubs.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.city_code = "HOU" |
How many clubs does the student named "Eric Tai" belong to? |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 clubs does the student named "Eric Tai" belong to?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT t1.clubname) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Eric" AND t3.lname = "Tai" |
Count the number of clubs for which the student named "Eric Tai" is a member. |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 `Count the number of clubs for which the student named "Eric Tai" is a member.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT t1.clubname) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Eric" AND t3.lname = "Tai" |
List the clubs having "Davis Steven" as a member. |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 clubs having "Davis Steven" as a member.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Davis" AND t3.lname = "Steven" |
What are the names of the clubs that have "Davis Steven" as a member? |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 names of the clubs that have "Davis Steven" as a member?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Davis" AND t3.lname = "Steven" |
List the clubs that have at least a member with advisor "1121". |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 clubs that have at least a member with advisor "1121".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.advisor = 1121 |
Which clubs have one or more members whose advisor is "1121"? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 clubs have one or more members whose advisor is "1121"?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.advisor = 1121 |
What is the average age of the members of the club "Bootup Baltimore"? |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 age of the members of the club "Bootup Baltimore"?` to a syntactically-correct PostgreSQL query.
| SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" |
Find the average age of the members in the club "Bootup Baltimore". |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 of the members in the club "Bootup Baltimore".` to a syntactically-correct PostgreSQL query.
| SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" |
Find the average age of members of the club "Hopkins Student Enterprises". |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 of members of the club "Hopkins Student Enterprises".` to a syntactically-correct PostgreSQL query.
| SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" |
On average, how old are the members in the club "Hopkins Student Enterprises"? |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 `On average, how old are the members in the club "Hopkins Student Enterprises"?` to a syntactically-correct PostgreSQL query.
| SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" |
Retrieve the average age of members of the club "Tennis Club". |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 `Retrieve the average age of members of the club "Tennis Club".` to a syntactically-correct PostgreSQL query.
| SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Tennis Club" |
Compute the average age of the members in the club "Tennis Club". |
-- 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: club
columns : [['club id', 'number'], ['club name', 'text'], ['club description', 'text'], ['club location', 'text']]
-- Table: member of club
columns : [['student id', 'number'], ['club id', 'number'], ['position', '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 `Compute the average age of the members in the club "Tennis Club".` to a syntactically-correct PostgreSQL query.
| SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Tennis Club" |
What are the distinct grant amount for the grants where the documents were sent before '1986-08-26 20:49:27' and grant were ended after '1989-03-16 18:27:16'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 distinct grant amount for the grants where the documents were sent before '1986-08-26 20:49:27' and grant were ended after '1989-03-16 18:27:16'?` to a syntactically-correct PostgreSQL query.
| SELECT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id WHERE T2.sent_date < '1986-08-26 20:49:27' INTERSECT SELECT grant_amount FROM grants WHERE grant_end_date > '1989-03-16 18:27:16' |
What are the different grant amounts for documents sent before '1986-08-26 20:49:27' and after the grant ended on '1989-03-16 18:27:16'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 different grant amounts for documents sent before '1986-08-26 20:49:27' and after the grant ended on '1989-03-16 18:27:16'?` to a syntactically-correct PostgreSQL query.
| SELECT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id WHERE T2.sent_date < '1986-08-26 20:49:27' INTERSECT SELECT grant_amount FROM grants WHERE grant_end_date > '1989-03-16 18:27:16' |
List the project details of the project both producing patent and paper as outcomes. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project details of the project both producing patent and paper as outcomes.` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Paper' INTERSECT SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Patent' |
What are the details of the project that is producing both patents and papers as outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details of the project that is producing both patents and papers as outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Paper' INTERSECT SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Patent' |
What is the total grant amount of the organisations described as research? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 total grant amount of the organisations described as research?` to a syntactically-correct PostgreSQL query.
| SELECT sum(grant_amount) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type = T3.organisation_type WHERE T3.organisation_type_description = 'Research' |
What is the total amount of grant money for research? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 total amount of grant money for research?` to a syntactically-correct PostgreSQL query.
| SELECT sum(grant_amount) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id JOIN organisation_Types AS T3 ON T2.organisation_type = T3.organisation_type WHERE T3.organisation_type_description = 'Research' |
List from which date and to which date these staff work: project staff of the project which hires the most staffs |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 from which date and to which date these staff work: project staff of the project which hires the most staffs` to a syntactically-correct PostgreSQL query.
| SELECT date_from , date_to FROM Project_Staff WHERE project_id IN( SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY count(*) DESC LIMIT 1 ) UNION SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'leader' |
From what date and to what date do the staff work on a project that has the most staff and has staff in a leader role? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `From what date and to what date do the staff work on a project that has the most staff and has staff in a leader role?` to a syntactically-correct PostgreSQL query.
| SELECT date_from , date_to FROM Project_Staff WHERE project_id IN( SELECT project_id FROM Project_Staff GROUP BY project_id ORDER BY count(*) DESC LIMIT 1 ) UNION SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'leader' |
Find the organisation ids and details of the organisations which are involved in |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 organisation ids and details of the organisations which are involved in` to a syntactically-correct PostgreSQL query.
| SELECT T2.organisation_id , T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_id HAVING sum(T1.grant_amount) > 6000 |
What are the ids and details for all organizations that have grants of more than 6000 dollars? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 ids and details for all organizations that have grants of more than 6000 dollars?` to a syntactically-correct PostgreSQL query.
| SELECT T2.organisation_id , T2.organisation_details FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_id HAVING sum(T1.grant_amount) > 6000 |
What is the organisation type and id of the organisation which has the most number of research staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 organisation type and id of the organisation which has the most number of research staff?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_type , T1.organisation_id FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1 |
What is the type and id of the organization that has the most research staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 type and id of the organization that has the most research staff?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_type , T1.organisation_id FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1 |
Which organisation type hires most research staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 organisation type hires most research staff?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_type FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_type ORDER BY count(*) DESC LIMIT 1 |
What is the type of the organization with the most research staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 type of the organization with the most research staff?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_type FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_type ORDER BY count(*) DESC LIMIT 1 |
Find out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described` to a syntactically-correct PostgreSQL query.
| SELECT T1.sent_date FROM documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research' |
What are the send dates for all documents that have a grant amount of more than 5000 and are involved in research? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 send dates for all documents that have a grant amount of more than 5000 and are involved in research?` to a syntactically-correct PostgreSQL query.
| SELECT T1.sent_date FROM documents AS T1 JOIN Grants AS T2 ON T1.grant_id = T2.grant_id JOIN Organisations AS T3 ON T2.organisation_id = T3.organisation_id JOIN organisation_Types AS T4 ON T3.organisation_type = T4.organisation_type WHERE T2.grant_amount > 5000 AND T4.organisation_type_description = 'Research' |
What are the response received dates for the documents described as 'Regular' or granted with more than 100? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 response received dates for the documents described as 'Regular' or granted with more than 100?` to a syntactically-correct PostgreSQL query.
| SELECT T1.response_received_date FROM Documents AS T1 JOIN Document_Types AS T2 ON T1.document_type_code = T2.document_type_code JOIN Grants AS T3 ON T1.grant_id = T3.grant_id WHERE T2.document_description = 'Regular' OR T3.grant_amount > 100 |
What is the response received date for the document described as Regular that was granted more than 100 dollars? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 response received date for the document described as Regular that was granted more than 100 dollars?` to a syntactically-correct PostgreSQL query.
| SELECT T1.response_received_date FROM Documents AS T1 JOIN Document_Types AS T2 ON T1.document_type_code = T2.document_type_code JOIN Grants AS T3 ON T1.grant_id = T3.grant_id WHERE T2.document_description = 'Regular' OR T3.grant_amount > 100 |
List the project details of the projects which did not hire any staff for a researcher role. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project details of the projects which did not hire any staff for a researcher role.` to a syntactically-correct PostgreSQL query.
| SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_Staff WHERE role_code = 'researcher' ) |
What are the details for all projects that did not hire any staff in a research role? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details for all projects that did not hire any staff in a research role?` to a syntactically-correct PostgreSQL query.
| SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_Staff WHERE role_code = 'researcher' ) |
What are the task details, task id and project id for the projects which are detailed as 'omnis' or have more than 2 outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 task details, task id and project id for the projects which are detailed as 'omnis' or have more than 2 outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT T1.task_details , T1.task_id , T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'omnis' UNION SELECT T1.task_details , T1.task_id , T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.project_id HAVING count(*) > 2 |
What are the task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT T1.task_details , T1.task_id , T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'omnis' UNION SELECT T1.task_details , T1.task_id , T2.project_id FROM Tasks AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.project_id HAVING count(*) > 2 |
When do all the researcher role staff start to work, and when do they stop working? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `When do all the researcher role staff start to work, and when do they stop working?` to a syntactically-correct PostgreSQL query.
| SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'researcher' |
When did researchers start and stop working? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `When did researchers start and stop working?` to a syntactically-correct PostgreSQL query.
| SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'researcher' |
How many kinds of roles are there for the staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 kinds of roles are there for the staff?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT role_code) FROM Project_Staff |
How many different roles are there on the project staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 different roles are there on the project staff?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT role_code) FROM Project_Staff |
What is the total amount of grants given by each organisations? Also list the organisation id. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 total amount of grants given by each organisations? Also list the organisation id.` to a syntactically-correct PostgreSQL query.
| SELECT sum(grant_amount) , organisation_id FROM Grants GROUP BY organisation_id |
What is the total amount of grant money given to each organization and what is its id? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 total amount of grant money given to each organization and what is its id?` to a syntactically-correct PostgreSQL query.
| SELECT sum(grant_amount) , organisation_id FROM Grants GROUP BY organisation_id |
List the project details of the projects with the research outcome described with the substring 'Published'. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project details of the projects with the research outcome described with the substring 'Published'.` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id JOIN Research_outcomes AS T3 ON T2.outcome_code = T3.outcome_code WHERE T3.outcome_description LIKE '%Published%' |
What are the details for the project whose research has been published? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details for the project whose research has been published?` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id JOIN Research_outcomes AS T3 ON T2.outcome_code = T3.outcome_code WHERE T3.outcome_description LIKE '%Published%' |
How many staff does each project has? List the project id and the number in an ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 staff does each project has? List the project id and the number in an ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_id , count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC |
For each project id, how many staff does it have? List them in increasing order. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `For each project id, how many staff does it have? List them in increasing order.` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_id , count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC |
What is the complete description of the researcher role. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 complete description of the researcher role.` to a syntactically-correct PostgreSQL query.
| SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher' |
What is the complete description of the job of a researcher? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 complete description of the job of a researcher?` to a syntactically-correct PostgreSQL query.
| SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher' |
When did the first staff for the projects started working? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `When did the first staff for the projects started working?` to a syntactically-correct PostgreSQL query.
| SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1 |
When did the first staff member start working? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `When did the first staff member start working?` to a syntactically-correct PostgreSQL query.
| SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1 |
Which project made the most number of outcomes? List the project details and the project id. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project made the most number of outcomes? List the project details and the project id.` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_details , T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) DESC LIMIT 1 |
What are the details and id of the project with the most outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details and id of the project with the most outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT T1.project_details , T1.project_id FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) DESC LIMIT 1 |
Which projects have no outcome? List the project details. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 projects have no outcome? List the project details.` to a syntactically-correct PostgreSQL query.
| SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes ) |
What are the details of the project with no outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details of the project with no outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes ) |
Which organisation hired the most number of research staff? List the organisation id, type and detail. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 organisation hired the most number of research staff? List the organisation id, type and detail.` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_id , T1.organisation_type , T1.organisation_details FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1 |
What are the ids, types, and details of the organization with the most research staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 ids, types, and details of the organization with the most research staff?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_id , T1.organisation_type , T1.organisation_details FROM Organisations AS T1 JOIN Research_Staff AS T2 ON T1.organisation_id = T2.employer_organisation_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1 |
Show the role description and the id of the project staff involved in most number of project outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 role description and the id of the project staff involved in most number of project outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT T1.role_description , T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code = T2.role_code JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id ORDER BY count(*) DESC LIMIT 1 |
For each staff id, what is the description of the role that is involved with the most number of projects? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `For each staff id, what is the description of the role that is involved with the most number of projects?` to a syntactically-correct PostgreSQL query.
| SELECT T1.role_description , T2.staff_id FROM Staff_Roles AS T1 JOIN Project_Staff AS T2 ON T1.role_code = T2.role_code JOIN Project_outcomes AS T3 ON T2.project_id = T3.project_id GROUP BY T2.staff_id ORDER BY count(*) DESC LIMIT 1 |
Which document type is described with the prefix 'Initial'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 document type is described with the prefix 'Initial'?` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%' |
What is the type of the document whose description starts with the word 'Initial'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 type of the document whose description starts with the word 'Initial'?` to a syntactically-correct PostgreSQL query.
| SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%' |
For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date.` to a syntactically-correct PostgreSQL query.
| SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Regular' INTERSECT SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Initial Application' |
For grants that have descriptions of Regular and Initial Applications, what are their start dates? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `For grants that have descriptions of Regular and Initial Applications, what are their start dates?` to a syntactically-correct PostgreSQL query.
| SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Regular' INTERSECT SELECT T1.grant_start_date FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id JOIN Document_Types AS T3 ON T2.document_type_code = T3.document_type_code WHERE T3.document_description = 'Initial Application' |
How many documents can one grant have at most? List the grant id and number. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 documents can one grant have at most? List the grant id and number.` to a syntactically-correct PostgreSQL query.
| SELECT grant_id , count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1 |
For each grant id, how many documents does it have, and which one has the most? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `For each grant id, how many documents does it have, and which one has the most?` to a syntactically-correct PostgreSQL query.
| SELECT grant_id , count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1 |
Find the organisation type description of the organisation detailed as 'quo'. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 organisation type description of the organisation detailed as 'quo'.` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_type_description FROM organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_details = 'quo' |
What is the type description of the organization whose detail is listed as 'quo'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 type description of the organization whose detail is listed as 'quo'?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_type_description FROM organisation_Types AS T1 JOIN Organisations AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_details = 'quo' |
What are all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT organisation_details FROM Organisations AS T1 JOIN organisation_Types AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_type_description = 'Sponsor' ORDER BY organisation_details |
What are the details of all organizations that are described as Sponsors and sort the results in ascending order? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details of all organizations that are described as Sponsors and sort the results in ascending order?` to a syntactically-correct PostgreSQL query.
| SELECT organisation_details FROM Organisations AS T1 JOIN organisation_Types AS T2 ON T1.organisation_type = T2.organisation_type WHERE T2.organisation_type_description = 'Sponsor' ORDER BY organisation_details |
How many Patent outcomes are generated from all the projects? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 Patent outcomes are generated from all the projects?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Project_outcomes WHERE outcome_code = 'Patent' |
How many patents outcomes were listed for all the projects? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 patents outcomes were listed for all the projects?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Project_outcomes WHERE outcome_code = 'Patent' |
How many project staff worked as leaders or started working before '1989-04-24 23:51:54'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project staff worked as leaders or started working before '1989-04-24 23:51:54'?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54' |
How many project members were leaders or started working before '1989-04-24 23:51:54'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project members were leaders or started working before '1989-04-24 23:51:54'?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54' |
What is the last date of the staff leaving the projects? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 last date of the staff leaving the projects?` to a syntactically-correct PostgreSQL query.
| SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1 |
What is the last date that a staff member left a project? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 last date that a staff member left a project?` to a syntactically-correct PostgreSQL query.
| SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1 |
What are the result description of the project whose detail is 'sint'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 result description of the project whose detail is 'sint'?` to a syntactically-correct PostgreSQL query.
| SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code JOIN Projects AS T3 ON T2.project_id = T3.project_id WHERE T3.project_details = 'sint' |
What is the description for the results whose project detail is 'sint'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 description for the results whose project detail is 'sint'?` to a syntactically-correct PostgreSQL query.
| SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code JOIN Projects AS T3 ON T2.project_id = T3.project_id WHERE T3.project_details = 'sint' |
List the organisation id with the maximum outcome count, and the count. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 organisation id with the maximum outcome count, and the count.` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_id , count(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1 |
What is the id of the organization with the maximum number of outcomes and how many outcomes are there? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 id of the organization with the maximum number of outcomes and how many outcomes are there?` to a syntactically-correct PostgreSQL query.
| SELECT T1.organisation_id , count(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1 |
List the project details of the projects launched by the organisation |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 project details of the projects launched by the organisation` to a syntactically-correct PostgreSQL query.
| SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 ) |
What are the details for the projects which were launched by the organization with the most projects? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details for the projects which were launched by the organization with the most projects?` to a syntactically-correct PostgreSQL query.
| SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 ) |
List the research staff details, and order in ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 research staff details, and order in ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC |
What details are there on the research staff? List the result in ascending alphabetical order. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 details are there on the research staff? List the result in ascending alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC |
How many tasks are there in total? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 tasks are there in total?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Tasks |
How many tasks are there? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 tasks are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM Tasks |
How many tasks does each project have? List the task count and the project detail. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 tasks does each project have? List the task count and the project detail.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id |
For each project id, how many tasks are there? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 `For each project id, how many tasks are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) , T1.project_details FROM Projects AS T1 JOIN Tasks AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id |
What are the staff roles of the staff who |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 staff roles of the staff who` to a syntactically-correct PostgreSQL query.
| SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18' |
What roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'?` to a syntactically-correct PostgreSQL query.
| SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18' |
What are the descriptions of all the project outcomes? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 descriptions of all the project outcomes?` to a syntactically-correct PostgreSQL query.
| SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code |
List the description of the outcomes for all projects. |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 description of the outcomes for all projects.` to a syntactically-correct PostgreSQL query.
| SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code |
Which role is most common for the staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 role is most common for the staff?` to a syntactically-correct PostgreSQL query.
| SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 |
What is the most common role for the staff? |
-- Language PostgreSQL
-- Tables:
-- Table: document types
columns : [['document type code', 'text'], ['document description', 'text']]
-- Table: documents
columns : [['document id', 'number'], ['document type code', 'text'], ['grant id', 'number'], ['sent date', 'time'], ['response received date', 'time'], ['other details', 'text']]
-- Table: grants
columns : [['grant id', 'number'], ['organisation id', 'number'], ['grant amount', 'number'], ['grant start date', 'time'], ['grant end date', 'time'], ['other details', 'text']]
-- Table: organisation types
columns : [['organisation type', 'text'], ['organisation type description', 'text']]
-- Table: organisations
columns : [['organisation id', 'number'], ['organisation type', 'text'], ['organisation details', 'text']]
-- Table: project outcomes
columns : [['project id', 'number'], ['outcome code', 'text'], ['outcome details', 'text']]
-- Table: project staff
columns : [['staff id', 'number'], ['project id', 'number'], ['role code', 'text'], ['date from', 'time'], ['date to', 'time'], ['other details', 'text']]
-- Table: projects
columns : [['project id', 'number'], ['organisation id', 'number'], ['project details', 'text']]
-- Table: research outcomes
columns : [['outcome code', 'text'], ['outcome description', 'text']]
-- Table: research staff
columns : [['staff id', 'number'], ['employer organisation id', 'number'], ['staff details', 'text']]
-- Table: staff roles
columns : [['role code', 'text'], ['role description', 'text']]
-- Table: tasks
columns : [['task id', 'number'], ['project id', 'number'], ['task details', 'text'], ['eg agree objectives', '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 most common role for the staff?` to a syntactically-correct PostgreSQL query.
| SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 |
How many friends does Dan have? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 friends does Dan have?` to a syntactically-correct PostgreSQL query.
| SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan' |
How many friends does Dan have? |
-- Language PostgreSQL
-- Tables:
-- Table: person
columns : [['name', 'text'], ['age', 'number'], ['city', 'text'], ['gender', 'text'], ['job', 'text']]
-- Table: person friend
columns : [['name', 'text'], ['friend', 'text'], ['year', '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 friends does Dan have?` to a syntactically-correct PostgreSQL query.
| SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.