sert121/SpiderSQL huggingface dataset:
-- 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.



Question: What is the type and id of the organization that has the most research staff?
SQL: 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
-- 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.



Question: Which organisation type hires most research staff?
SQL: 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
-- 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.



Question: What is the type of the organization with the most research staff?
SQL: 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
-- 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.



Question: Find out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described
SQL: 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'
-- 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.



Question: What are the send dates for all documents that have a grant amount of more than 5000 and are involved in research?
SQL: 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'
-- 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.



Question: What are the response received dates for the documents described as 'Regular' or granted with more than 100?
SQL: 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
-- 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.



Question: What is the response received date for the document described as Regular that was granted more than 100 dollars?
SQL: 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
-- 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.



Question: List the project details of the projects which did not hire any staff for a researcher role.
SQL: SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_Staff WHERE role_code  =  '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.



Question: What are the details for all projects that did not hire any staff in a research role?
SQL: SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_Staff WHERE role_code  =  '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.



Question: What are the task details, task id and project id for the projects which are detailed as 'omnis' or  have more than 2 outcomes?
SQL: 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
-- 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.



Question: What are the task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes?
SQL: 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
-- 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.



Question: When do all the researcher role staff start to work, and when do they stop working?
SQL: SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  '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.



Question: When did researchers start and stop working?
SQL: SELECT date_from ,  date_to FROM Project_Staff WHERE role_code  =  '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.



Question: How many kinds of roles are there for the staff?
SQL: SELECT count(DISTINCT role_code) FROM 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.



Question: How many different roles are there on the project staff?
SQL: SELECT count(DISTINCT role_code) FROM 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.



Question: What is the total amount of grants given by each organisations? Also list the organisation id.
SQL: SELECT sum(grant_amount) ,  organisation_id FROM Grants GROUP BY 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.



Question: What is the total amount of grant money given to each organization and what is its id?
SQL: SELECT sum(grant_amount) ,  organisation_id FROM Grants GROUP BY 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.



Question: List the project details of the projects with the research outcome described with the substring 'Published'.
SQL: 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%'
-- 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.



Question: What are the details for the project whose research has been published?
SQL: 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%'
-- 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.



Question: How many staff does each project has? List the project id and the number in an ascending order.
SQL: 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
-- 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.



Question: For each project id, how many staff does it have? List them in increasing order.
SQL: 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