
CREATE TABLE "Document_Types" (
	document_type_code VARCHAR(10), 
	document_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (document_type_code)
)


CREATE TABLE "Documents" (
	document_id INTEGER, 
	document_type_code VARCHAR(10), 
	grant_id INTEGER NOT NULL, 
	sent_date DATETIME NOT NULL, 
	response_received_date DATETIME NOT NULL, 
	other_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (document_id), 
	FOREIGN KEY(grant_id) REFERENCES "Grants" (grant_id), 
	FOREIGN KEY(document_type_code) REFERENCES "Document_Types" (document_type_code)
)


CREATE TABLE "Grants" (
	grant_id INTEGER, 
	organisation_id INTEGER NOT NULL, 
	grant_amount DECIMAL(19, 4) DEFAULT 0 NOT NULL, 
	grant_start_date DATETIME NOT NULL, 
	grant_end_date DATETIME NOT NULL, 
	other_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (grant_id), 
	FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)


CREATE TABLE "Organisation_Types" (
	organisation_type VARCHAR(10), 
	organisation_type_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (organisation_type)
)


CREATE TABLE "Organisations" (
	organisation_id INTEGER, 
	organisation_type VARCHAR(10) NOT NULL, 
	organisation_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (organisation_id), 
	FOREIGN KEY(organisation_type) REFERENCES "Organisation_Types" (organisation_type)
)


CREATE TABLE "Project_Outcomes" (
	project_id INTEGER NOT NULL, 
	outcome_code VARCHAR(10) NOT NULL, 
	outcome_details VARCHAR(255), 
	FOREIGN KEY(outcome_code) REFERENCES "Research_Outcomes" (outcome_code), 
	FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)


CREATE TABLE "Project_Staff" (
	staff_id DOUBLE, 
	project_id INTEGER NOT NULL, 
	role_code VARCHAR(10) NOT NULL, 
	date_from DATETIME, 
	date_to DATETIME, 
	other_details VARCHAR(255), 
	PRIMARY KEY (staff_id), 
	FOREIGN KEY(role_code) REFERENCES "Staff_Roles" (role_code), 
	FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)


CREATE TABLE "Projects" (
	project_id INTEGER, 
	organisation_id INTEGER NOT NULL, 
	project_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (project_id), 
	FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)


CREATE TABLE "Research_Outcomes" (
	outcome_code VARCHAR(10), 
	outcome_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (outcome_code)
)


CREATE TABLE "Research_Staff" (
	staff_id INTEGER, 
	employer_organisation_id INTEGER NOT NULL, 
	staff_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (staff_id), 
	FOREIGN KEY(employer_organisation_id) REFERENCES "Organisations" (organisation_id)
)


CREATE TABLE "Staff_Roles" (
	role_code VARCHAR(10), 
	role_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (role_code)
)


CREATE TABLE "Tasks" (
	task_id INTEGER, 
	project_id INTEGER NOT NULL, 
	task_details VARCHAR(255) NOT NULL, 
	"eg Agree Objectives" VARCHAR(1), 
	PRIMARY KEY (task_id), 
	FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)

CREATE TABLE "Document_Types" (
	document_type_code VARCHAR(10), 
	document_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (document_type_code)
)

/*
2 rows from Document_Types table:
document_type_code	document_description
APP	Initial Application
REG	Regular
*/


CREATE TABLE "Documents" (
	document_id INTEGER, 
	document_type_code VARCHAR(10), 
	grant_id INTEGER NOT NULL, 
	sent_date DATETIME NOT NULL, 
	response_received_date DATETIME NOT NULL, 
	other_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (document_id), 
	FOREIGN KEY(grant_id) REFERENCES "Grants" (grant_id), 
	FOREIGN KEY(document_type_code) REFERENCES "Document_Types" (document_type_code)
)

/*
2 rows from Documents table:
document_id	document_type_code	grant_id	sent_date	response_received_date	other_details
1	APP	5	1986-11-30 07:56:35	1977-12-01 02:18:53	
2	APP	13	2004-01-23 11:57:08	1979-12-08 10:38:07	
*/


CREATE TABLE "Grants" (
	grant_id INTEGER, 
	organisation_id INTEGER NOT NULL, 
	grant_amount DECIMAL(19, 4) DEFAULT 0 NOT NULL, 
	grant_start_date DATETIME NOT NULL, 
	grant_end_date DATETIME NOT NULL, 
	other_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (grant_id), 
	FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)

/*
2 rows from Grants table:
grant_id	organisation_id	grant_amount	grant_start_date	grant_end_date	other_details
1	10	4094.5420	2016-11-20 00:18:51	2004-10-24 09:09:39	et
2	3	281.2446	1985-10-09 20:08:49	1985-06-08 00:22:07	occaecati
*/


CREATE TABLE "Organisation_Types" (
	organisation_type VARCHAR(10), 
	organisation_type_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (organisation_type)
)

/*
2 rows from Organisation_Types table:
organisation_type	organisation_type_description
RES	Research
SPON	Sponsor
*/


CREATE TABLE "Organisations" (
	organisation_id INTEGER, 
	organisation_type VARCHAR(10) NOT NULL, 
	organisation_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (organisation_id), 
	FOREIGN KEY(organisation_type) REFERENCES "Organisation_Types" (organisation_type)
)

/*
2 rows from Organisations table:
organisation_id	organisation_type	organisation_details
1	RES	et
2	RES	eius
*/


CREATE TABLE "Project_Outcomes" (
	project_id INTEGER NOT NULL, 
	outcome_code VARCHAR(10) NOT NULL, 
	outcome_details VARCHAR(255), 
	FOREIGN KEY(outcome_code) REFERENCES "Research_Outcomes" (outcome_code), 
	FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)

/*
2 rows from Project_Outcomes table:
project_id	outcome_code	outcome_details
4	Paper	None
3	Patent	None
*/


CREATE TABLE "Project_Staff" (
	staff_id DOUBLE, 
	project_id INTEGER NOT NULL, 
	role_code VARCHAR(10) NOT NULL, 
	date_from DATETIME, 
	date_to DATETIME, 
	other_details VARCHAR(255), 
	PRIMARY KEY (staff_id), 
	FOREIGN KEY(role_code) REFERENCES "Staff_Roles" (role_code), 
	FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)

/*
2 rows from Project_Staff table:
staff_id	project_id	role_code	date_from	date_to	other_details
0.0	2	leader	1981-10-04 22:44:50	1985-05-30 22:26:30	None
674810.0	5	leader	2003-04-19 15:06:20	2010-12-08 11:55:36	None
*/


CREATE TABLE "Projects" (
	project_id INTEGER, 
	organisation_id INTEGER NOT NULL, 
	project_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (project_id), 
	FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id)
)

/*
2 rows from Projects table:
project_id	organisation_id	project_details
1	15	porro
2	11	et
*/


CREATE TABLE "Research_Outcomes" (
	outcome_code VARCHAR(10), 
	outcome_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (outcome_code)
)

/*
2 rows from Research_Outcomes table:
outcome_code	outcome_description
Paper	Published Research Paper
Patent	Research Patent
*/


CREATE TABLE "Research_Staff" (
	staff_id INTEGER, 
	employer_organisation_id INTEGER NOT NULL, 
	staff_details VARCHAR(255) NOT NULL, 
	PRIMARY KEY (staff_id), 
	FOREIGN KEY(employer_organisation_id) REFERENCES "Organisations" (organisation_id)
)

/*
2 rows from Research_Staff table:
staff_id	employer_organisation_id	staff_details
1	1	quo
2	4	est
*/


CREATE TABLE "Staff_Roles" (
	role_code VARCHAR(10), 
	role_description VARCHAR(255) NOT NULL, 
	PRIMARY KEY (role_code)
)

/*
2 rows from Staff_Roles table:
role_code	role_description
leader	Project Leader
researcher	Project Researcher
*/


CREATE TABLE "Tasks" (
	task_id INTEGER, 
	project_id INTEGER NOT NULL, 
	task_details VARCHAR(255) NOT NULL, 
	"eg Agree Objectives" VARCHAR(1), 
	PRIMARY KEY (task_id), 
	FOREIGN KEY(project_id) REFERENCES "Projects" (project_id)
)

/*
2 rows from Tasks table:
task_id	project_id	task_details	eg Agree Objectives
1	1	a	None
2	2	b	None
*/
What are the details of all organizations that are described as Sponsors and sort the results in ascending order?
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
[{'organisation_details': 'aperiam'}, {'organisation_details': 'consequuntur'}, {'organisation_details': 'eos'}, {'organisation_details': 'eveniet'}, {'organisation_details': 'officiis'}, {'organisation_details': 'tenetur'}, {'organisation_details': 'voluptas'}]