Database: tracking_grants_for_research

Question: Which document type is described with the prefix 'Initial'?
SQL: SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%';

Question: For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date.
SQL: 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'

Question: How many documents can one grant have at most? List the grant id and number.
SQL: SELECT grant_id ,  count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1;

Question: Find the organisation type description of the organisation detailed as 'quo'.
SQL: 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';

Question: What are all the details of the organisations described as 'Sponsor'? Sort the result in an ascending order.
SQL: 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 ASC;

Question: How many project staff worked as leaders or started working before '1989-04-24 23:51:54'?
SQL: SELECT count(*) FROM Project_Staff WHERE role_code  =  'leader' OR date_from  <  '1989-04-24 23:51:54';

Question: What is the last date of the staff leaving the projects?
SQL: SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1;

Question: What are the result description of the project whose detail is 'sint'?
SQL: 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';

Question: List the organisation id with the maximum outcome count, and the count.
SQL: 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;

Question: List the project details of the projects launched by the organisation with the most number of projects.
SQL: SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 );

Question: How many tasks does each project have? List the task count and the project detail.
SQL: 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;