db_id stringclasses 146
values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146
values |
|---|---|---|---|
club_1 | How many members of "Bootup Baltimore" are older than 18? | 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 | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Count the number of members in club "Bootup Baltimore" whose age is above 18. | 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 | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | How many members of club "Bootup Baltimore" are younger than 18? | 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 | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Count the number of members in club "Bootup Baltimore" whose age is below 18. | 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 | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Find the names of all the clubs that have at least a member from the city with city code "BAL". | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Which clubs have one or more members from the city with code "BAL"? Give me the names of the clubs. | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Find the names of the clubs that have at least a member from the city with city code "HOU". | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Which clubs have one or more members from the city with code "HOU"? Give me the names of the clubs. | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | How many clubs does the student named "Eric Tai" belong to? | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Count the number of clubs for which the student named "Eric Tai" is a member. | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | List the clubs having "Davis Steven" as a member. | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | What are the names of the clubs that have "Davis Steven" as a member? | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | List the clubs that have at least a member with advisor "1121". | 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 | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Which clubs have one or more members whose advisor is "1121"? | 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 | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | What is the average age of the members of the club "Bootup Baltimore"? | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Find the average age of the members in the club "Bootup Baltimore". | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Find the average age of members of the club "Hopkins Student Enterprises". | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | On average, how old are the members in the club "Hopkins Student Enterprises"? | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Retrieve the average age of members of the club "Tennis Club". | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
club_1 | Compute the average age of the members in the club "Tennis Club". | 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" | CREATE TABLE Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
3 rows from Student table:
StuID LName Fname Age Sex Major Advisor city_code
1001 Smith Linda 18 F 600 1121 BAL
1002 Kim Tracy 19 F 600 7712 HKG
1003 Jones Shiela 21 F 600 7792 WAS
CREATE TABLE Club (
ClubID INTEGER PRIMARY KEY,
ClubName VARCHAR(40),
ClubDesc VARCHAR(1024),
ClubLocation VARCHAR(40)
)
3 rows from Club table:
ClubID ClubName ClubDesc ClubLocation
1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW
2 Hopkins Student Enterprises Venture capital fund for student business. AKW
3 Pen and Paper Gaming Play pen and paper games on campus. HHH
CREATE TABLE Member_of_club (
StuID INTEGER,
ClubID INTEGER,
Position VARCHAR(40),
FOREIGN KEY(StuID) REFERENCES Student(StuID),
FOREIGN KEY(ClubID) REFERENCES Club(ClubID)
)
3 rows from Member_of_club table:
StuID ClubID Position
1001 1 President
1007 4 Vice-President
1008 2 CTO
|
tracking_grants_for_research | 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'? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | 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'? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the project details of the project both producing patent and paper as outcomes. | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the details of the project that is producing both patents and papers as outcomes? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the total grant amount of the organisations described as research? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the total amount of grant money for research? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List from which date and to which date these staff work: project staff of the project which hires the most staffs | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | 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? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Find the organisation ids and details of the organisations which are involved in | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the ids and details for all organizations that have grants of more than 6000 dollars? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the organisation type and id of the organisation which has the most number of research staff? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the type and id of the organization that has the most research staff? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Which organisation type hires most research staff? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the type of the organization with the most research staff? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Find out the send dates of the documents with the grant amount of more than 5000 were granted by organisation type described | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the send dates for all documents that have a grant amount of more than 5000 and are involved in research? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the response received dates for the documents described as 'Regular' or granted with more than 100? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the response received date for the document described as Regular that was granted more than 100 dollars? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the project details of the projects which did not hire any staff for a researcher role. | SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_Staff WHERE role_code = 'researcher' ) | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the details for all projects that did not hire any staff in a research role? | SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_Staff WHERE role_code = 'researcher' ) | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the task details, task id and project id for the projects which are detailed as 'omnis' or have more than 2 outcomes? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the task details, task ids, and project ids for the progrects that are detailed as 'omnis' or have at least 3 outcomes? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | When do all the researcher role staff start to work, and when do they stop working? | SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'researcher' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | When did researchers start and stop working? | SELECT date_from , date_to FROM Project_Staff WHERE role_code = 'researcher' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many kinds of roles are there for the staff? | SELECT count(DISTINCT role_code) FROM Project_Staff | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many different roles are there on the project staff? | SELECT count(DISTINCT role_code) FROM Project_Staff | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the total amount of grants given by each organisations? Also list the organisation id. | SELECT sum(grant_amount) , organisation_id FROM Grants GROUP BY organisation_id | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the total amount of grant money given to each organization and what is its id? | SELECT sum(grant_amount) , organisation_id FROM Grants GROUP BY organisation_id | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the project details of the projects with the research outcome described with the substring 'Published'. | 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%' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the details for the project whose research has been published? | 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%' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many staff does each project has? List the project id and the number in an ascending order. | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | For each project id, how many staff does it have? List them in increasing order. | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the complete description of the researcher role. | SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the complete description of the job of a researcher? | SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | When did the first staff for the projects started working? | SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | When did the first staff member start working? | SELECT date_from FROM Project_Staff ORDER BY date_from ASC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Which project made the most number of outcomes? List the project details and the project id. | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the details and id of the project with the most outcomes? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Which projects have no outcome? List the project details. | SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes ) | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the details of the project with no outcomes? | SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes ) | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Which organisation hired the most number of research staff? List the organisation id, type and detail. | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the ids, types, and details of the organization with the most research staff? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Show the role description and the id of the project staff involved in most number of project outcomes? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | For each staff id, what is the description of the role that is involved with the most number of projects? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Which document type is described with the prefix 'Initial'? | SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the type of the document whose description starts with the word 'Initial'? | SELECT document_type_code FROM Document_Types WHERE document_description LIKE 'Initial%' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | For grants with both documents described as 'Regular' and documents described as 'Initial Application', list its start date. | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | For grants that have descriptions of Regular and Initial Applications, what are their start dates? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many documents can one grant have at most? List the grant id and number. | SELECT grant_id , count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | For each grant id, how many documents does it have, and which one has the most? | SELECT grant_id , count(*) FROM Documents GROUP BY grant_id ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Find the organisation type description of the organisation detailed as 'quo'. | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the type description of the organization whose detail is listed as 'quo'? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are all the details of the organisations described as 'Sponsor'? Sort the result in an 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many Patent outcomes are generated from all the projects? | SELECT count(*) FROM Project_outcomes WHERE outcome_code = 'Patent' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many patents outcomes were listed for all the projects? | SELECT count(*) FROM Project_outcomes WHERE outcome_code = 'Patent' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many project staff worked as leaders or started working before '1989-04-24 23:51:54'? | SELECT count(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many project members were leaders or started working before '1989-04-24 23:51:54'? | SELECT count(*) FROM Project_Staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the last date of the staff leaving the projects? | SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the last date that a staff member left a project? | SELECT date_to FROM Project_Staff ORDER BY date_to DESC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the result description of the project whose detail is 'sint'? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the description for the results whose project detail is 'sint'? | 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' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the organisation id with the maximum outcome count, and the count. | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the id of the organization with the maximum number of outcomes and how many outcomes are there? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the project details of the projects launched by the organisation | SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 ) | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the details for the projects which were launched by the organization with the most projects? | SELECT project_details FROM Projects WHERE organisation_id IN ( SELECT organisation_id FROM Projects GROUP BY organisation_id ORDER BY count(*) DESC LIMIT 1 ) | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the research staff details, and order in ascending order. | SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What details are there on the research staff? List the result in ascending alphabetical order. | SELECT staff_details FROM Research_Staff ORDER BY staff_details ASC | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many tasks are there in total? | SELECT count(*) FROM Tasks | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many tasks are there? | SELECT count(*) FROM Tasks | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | How many tasks does each project have? List the task count and the project detail. | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | For each project id, how many tasks are there? | 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 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the staff roles of the staff who | SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'? | SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18' | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What are the descriptions of all the project outcomes? | SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | List the description of the outcomes for all projects. | SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | Which role is most common for the staff? | SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
tracking_grants_for_research | What is the most common role for the staff? | SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `Document_Types` (
`document_type_code` VARCHAR(10) PRIMARY KEY,
`document_description` VARCHAR(255) NOT NULL
)
3 rows from Document_Types table:
document_type_code document_description
APP Initial Application
REG Regular
CREATE TABLE `Documents` (
`document_id` INTEGER PRIMARY KEY,
`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,
FOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),
FOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )
)
3 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
3 REG 10 1999-03-03 12:25:58 1995-09-12 13:13:48
CREATE TABLE `Grants` (
`grant_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,
`grant_start_date` DATETIME NOT NULL,
`grant_end_date` DATETIME NOT NULL,
`other_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 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
3 14 4515947.7015 1970-09-19 22:53:49 1989-03-16 18:27:16 et
CREATE TABLE `Organisation_Types` (
`organisation_type` VARCHAR(10) PRIMARY KEY,
`organisation_type_description` VARCHAR(255) NOT NULL
)
3 rows from Organisation_Types table:
organisation_type organisation_type_description
RES Research
SPON Sponsor
CREATE TABLE `Organisations` (
`organisation_id` INTEGER PRIMARY KEY,
`organisation_type` VARCHAR(10) NOT NULL,
`organisation_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )
)
3 rows from Organisations table:
organisation_id organisation_type organisation_details
1 RES et
2 RES eius
3 RES impedit
CREATE TABLE `Project_Outcomes` (
`project_id` INTEGER NOT NULL,
`outcome_code` VARCHAR(10) NOT NULL,
`outcome_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )
)
3 rows from Project_Outcomes table:
project_id outcome_code outcome_details
4 Paper None
3 Patent None
9 Paper None
CREATE TABLE `Project_Staff` (
`staff_id` DOUBLE PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`role_code` VARCHAR(10) NOT NULL,
`date_from` DATETIME,
`date_to` DATETIME,
`other_details` VARCHAR(255),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )
)
3 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
779.0 2 researcher 1981-10-09 21:32:53 2004-12-16 13:03:36 None
CREATE TABLE `Projects` (
`project_id` INTEGER PRIMARY KEY,
`organisation_id` INTEGER NOT NULL,
`project_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Projects table:
project_id organisation_id project_details
1 15 porro
2 11 et
3 7 sint
CREATE TABLE `Research_Outcomes` (
`outcome_code` VARCHAR(10) PRIMARY KEY,
`outcome_description` VARCHAR(255) NOT NULL
)
3 rows from Research_Outcomes table:
outcome_code outcome_description
Paper Published Research Paper
Patent Research Patent
CREATE TABLE `Research_Staff` (
`staff_id` INTEGER PRIMARY KEY,
`employer_organisation_id` INTEGER NOT NULL,
`staff_details` VARCHAR(255) NOT NULL,
FOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )
)
3 rows from Research_Staff table:
staff_id employer_organisation_id staff_details
1 1 quo
2 4 est
3 5 aspernatur
CREATE TABLE `Staff_Roles` (
`role_code` VARCHAR(10) PRIMARY KEY,
`role_description` VARCHAR(255) NOT NULL
)
3 rows from Staff_Roles table:
role_code role_description
leader Project Leader
researcher Project Researcher
CREATE TABLE `Tasks` (
`task_id` INTEGER PRIMARY KEY,
`project_id` INTEGER NOT NULL,
`task_details` VARCHAR(255) NOT NULL,
`eg Agree Objectives` VARCHAR(1),
FOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )
)
3 rows from Tasks table:
task_id project_id task_details eg Agree Objectives
1 1 a None
2 2 b None
3 3 c None
|
network_2 | How many friends does Dan have? | SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan' | CREATE TABLE Person (
name varchar(20) PRIMARY KEY,
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
3 rows from Person table:
name age city gender job
Alice 25 new york city female student
Bob 35 salt lake city male engineer
Zach 45 austin male doctor
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER,
FOREIGN KEY (name) REFERENCES Person(name),
FOREIGN KEY (friend) REFERENCES Person(name)
)
3 rows from PersonFriend table:
name friend year
Alice Bob 10
Zach Dan 12
Bob Zach 5
|
network_2 | How many friends does Dan have? | SELECT count(T2.friend) FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T1.name = 'Dan' | CREATE TABLE Person (
name varchar(20) PRIMARY KEY,
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
3 rows from Person table:
name age city gender job
Alice 25 new york city female student
Bob 35 salt lake city male engineer
Zach 45 austin male doctor
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER,
FOREIGN KEY (name) REFERENCES Person(name),
FOREIGN KEY (friend) REFERENCES Person(name)
)
3 rows from PersonFriend table:
name friend year
Alice Bob 10
Zach Dan 12
Bob Zach 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.