Search is not available for this dataset
db_id
stringlengths 3
31
| query
stringlengths 20
523
| question
stringlengths 3
224
| schema
stringlengths 589
322M
| query_res
stringlengths 0
363k
|
---|---|---|---|---|
department_management | SELECT count(*) FROM head WHERE age > 56 | How many heads of the departments are older than 56 ? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (5,)
|
department_management | SELECT name , born_state , age FROM head ORDER BY age | List the name, born state and age of the heads of departments ordered by age. | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('Pádraig Harrington', 'Connecticut', 43.0)
('Stewart Cink', 'Florida', 50.0)
('Dudley Hart', 'California', 52.0)
('Jeff Maggert', 'Delaware', 53.0)
('Nick Faldo', 'California', 56.0)
('Tiger Woods', 'Alabama', 67.0)
('Franklin Langham', 'Connecticut', 67.0)
('Sergio García', 'California', 68.0)
('K. J. Choi', 'Alabama', 69.0)
('Billy Mayfair', 'California', 69.0)
|
department_management | SELECT creation , name , budget_in_billions FROM department | List the creation year, name and budget of each department. | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('1789', 'State', 9.96)
('1789', 'Treasury', 11.1)
('1947', 'Defense', 439.3)
('1870', 'Justice', 23.4)
('1849', 'Interior', 10.7)
('1889', 'Agriculture', 77.6)
('1903', 'Commerce', 6.2)
('1913', 'Labor', 59.7)
('1953', 'Health and Human Services', 543.2)
('1965', 'Housing and Urban Development', 46.2)
('1966', 'Transportation', 58.0)
('1977', 'Energy', 21.5)
('1979', 'Education', 62.8)
('1989', 'Veterans Affairs', 73.2)
('2002', 'Homeland Security', 44.6)
|
department_management | SELECT max(budget_in_billions) , min(budget_in_billions) FROM department | What are the maximum and minimum budget of the departments? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (543.2, 6.2)
|
department_management | SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15 | What is the average number of employees of the departments whose rank is between 10 and 15? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (105468.16666666667,)
|
department_management | SELECT name FROM head WHERE born_state != 'California' | What are the names of the heads who are born outside the California state? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('Tiger Woods',)
('K. J. Choi',)
('Jeff Maggert',)
('Stewart Cink',)
('Pádraig Harrington',)
('Franklin Langham',)
|
department_management | SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama' | What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('1903',)
|
department_management | SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3 | What are the names of the states where at least 3 heads were born? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('California',)
|
department_management | SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1 | In which year were most departments established? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('1789',)
|
department_management | SELECT T1.name , T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes' | Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('Treasury', 115897.0)
('Homeland Security', 208000.0)
('Treasury', 115897.0)
|
department_management | SELECT count(DISTINCT temporary_acting) FROM management | How many acting statuses are there? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (2,)
|
department_management | SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management); | How many departments are led by heads who are not mentioned? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (11,)
|
department_management | SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes' | What are the distinct ages of the heads who are acting? | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (53.0,)
(52.0,)
(69.0,)
|
department_management | SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Homeland Security' | List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| ('California',)
|
department_management | SELECT T1.department_id , T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1 | Which department has more than 1 head at a time? List the id, name and the number of heads. | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (2, 'Treasury', 2)
|
department_management | SELECT head_id , name FROM head WHERE name LIKE '%Ha%' | Which head's name has the substring 'Ha'? List the id and name. | PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "department" (
"Department_ID" int,
"Name" text,
"Creation" text,
"Ranking" int,
"Budget_in_Billions" real,
"Num_Employees" real,
PRIMARY KEY ("Department_ID")
);
INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.999999999999999);
INSERT INTO department VALUES(2,'Treasury','1789','2',11.099999999999999644,115896.99999999999999);
INSERT INTO department VALUES(3,'Defense','1947','3',439.30000000000001135,3000000.0);
INSERT INTO department VALUES(4,'Justice','1870','4',23.399999999999998578,112556.99999999999999);
INSERT INTO department VALUES(5,'Interior','1849','5',10.699999999999999289,71436.000000000000002);
INSERT INTO department VALUES(6,'Agriculture','1889','6',77.599999999999994316,109831.99999999999999);
INSERT INTO department VALUES(7,'Commerce','1903','7',6.2000000000000001776,35999.999999999999999);
INSERT INTO department VALUES(8,'Labor','1913','8',59.700000000000002843,17346.999999999999999);
INSERT INTO department VALUES(9,'Health and Human Services','1953','9',543.20000000000004548,66999.999999999999998);
INSERT INTO department VALUES(10,'Housing and Urban Development','1965','10',46.200000000000002843,10599.999999999999999);
INSERT INTO department VALUES(11,'Transportation','1966','11',58.000000000000000001,58621.999999999999998);
INSERT INTO department VALUES(12,'Energy','1977','12',21.5,116099.99999999999999);
INSERT INTO department VALUES(13,'Education','1979','13',62.799999999999997156,4487.0000000000000001);
INSERT INTO department VALUES(14,'Veterans Affairs','1989','14',73.200000000000002842,234999.99999999999999);
INSERT INTO department VALUES(15,'Homeland Security','2002','15',44.600000000000001422,207999.99999999999999);
CREATE TABLE IF NOT EXISTS "head" (
"head_ID" int,
"name" text,
"born_state" text,
"age" real,
PRIMARY KEY ("head_ID")
);
INSERT INTO head VALUES(1,'Tiger Woods','Alabama',66.999999999999999998);
INSERT INTO head VALUES(2,'Sergio García','California',68.000000000000000001);
INSERT INTO head VALUES(3,'K. J. Choi','Alabama',69.0);
INSERT INTO head VALUES(4,'Dudley Hart','California',51.999999999999999998);
INSERT INTO head VALUES(5,'Jeff Maggert','Delaware',53.000000000000000001);
INSERT INTO head VALUES(6,'Billy Mayfair','California',69.0);
INSERT INTO head VALUES(7,'Stewart Cink','Florida',50.0);
INSERT INTO head VALUES(8,'Nick Faldo','California',55.999999999999999999);
INSERT INTO head VALUES(9,'Pádraig Harrington','Connecticut',43.000000000000000001);
INSERT INTO head VALUES(10,'Franklin Langham','Connecticut',66.999999999999999998);
CREATE TABLE IF NOT EXISTS "management" (
"department_ID" int,
"head_ID" int,
"temporary_acting" text,
PRIMARY KEY ("Department_ID","head_ID"),
FOREIGN KEY ("Department_ID") REFERENCES `department`("Department_ID"),
FOREIGN KEY ("head_ID") REFERENCES `head`("head_ID")
);
INSERT INTO management VALUES(2,5,'Yes');
INSERT INTO management VALUES(15,4,'Yes');
INSERT INTO management VALUES(2,6,'Yes');
INSERT INTO management VALUES(7,3,'No');
INSERT INTO management VALUES(11,10,'No');
COMMIT;
| (4, 'Dudley Hart')
(9, 'Pádraig Harrington')
(10, 'Franklin Langham')
|
farm | SELECT count(*) FROM farm | How many farms are there? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (8,)
|
farm | SELECT count(*) FROM farm | Count the number of farms. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (8,)
|
farm | SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC | List the total number of horses on farms in ascending order. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (2546.9,)
(2604.8,)
(3658.9,)
(4781.3,)
(5056.5,)
(5308.2,)
(5486.9,)
(5607.5,)
|
farm | SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC | What is the total horses record for each farm, sorted ascending? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (2546.9,)
(2604.8,)
(3658.9,)
(4781.3,)
(5056.5,)
(5308.2,)
(5486.9,)
(5607.5,)
|
farm | SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens' | What are the hosts of competitions whose theme is not "Aliens"? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Miley Cyrus Jared Leto and Karen Mok',)
('Leehom Wang and Kelly Rowland',)
('Alicia Keys',)
('Vanness Wu and Michelle Branch',)
('Shaggy and Coco Lee',)
|
farm | SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens' | Return the hosts of competitions for which the theme is not Aliens? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Miley Cyrus Jared Leto and Karen Mok',)
('Leehom Wang and Kelly Rowland',)
('Alicia Keys',)
('Vanness Wu and Michelle Branch',)
('Shaggy and Coco Lee',)
|
farm | SELECT Theme FROM farm_competition ORDER BY YEAR ASC | What are the themes of farm competitions sorted by year in ascending order? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Aliens',)
('MTV Cube',)
("Valentine's Day",)
('MTV Asia Aid',)
('Codehunters',)
('Carnival M is back!',)
|
farm | SELECT Theme FROM farm_competition ORDER BY YEAR ASC | Return the themes of farm competitions, sorted by year ascending. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Aliens',)
('MTV Cube',)
("Valentine's Day",)
('MTV Asia Aid',)
('Codehunters',)
('Carnival M is back!',)
|
farm | SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000 | What is the average number of working horses of farms with more than 5000 total number of horses? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (3977.7500000000005,)
|
farm | SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000 | Give the average number of working horses on farms with more than 5000 total horses. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (3977.7500000000005,)
|
farm | SELECT max(Cows) , min(Cows) FROM farm | What are the maximum and minimum number of cows across all farms. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (3987.0, 2407.2)
|
farm | SELECT max(Cows) , min(Cows) FROM farm | Return the maximum and minimum number of cows across all farms. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (3987.0, 2407.2)
|
farm | SELECT count(DISTINCT Status) FROM city | How many different statuses do cities have? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (2,)
|
farm | SELECT count(DISTINCT Status) FROM city | Count the number of different statuses. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (2,)
|
farm | SELECT Official_Name FROM city ORDER BY Population DESC | List official names of cities in descending order of population. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Grand Falls/Grand-Sault',)
('Perth-Andover',)
('Plaster Rock',)
('Drummond',)
('Aroostook',)
|
farm | SELECT Official_Name FROM city ORDER BY Population DESC | What are the official names of cities, ordered descending by population? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Grand Falls/Grand-Sault',)
('Perth-Andover',)
('Plaster Rock',)
('Drummond',)
('Aroostook',)
|
farm | SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1 | List the official name and status of the city with the largest population. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Grand Falls/Grand-Sault', 'Town')
|
farm | SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1 | What is the official name and status of the city with the most residents? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Grand Falls/Grand-Sault', 'Town')
|
farm | SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID | Show the years and the official names of the host cities of competitions. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (2013, 'Grand Falls/Grand-Sault')
(2006, 'Perth-Andover')
(2005, 'Plaster Rock')
(2004, 'Drummond')
(2003, 'Aroostook')
(2002, 'Aroostook')
|
farm | SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID | Give the years and official names of the cities of each competition. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| (2013, 'Grand Falls/Grand-Sault')
(2006, 'Perth-Andover')
(2005, 'Plaster Rock')
(2004, 'Drummond')
(2003, 'Aroostook')
(2002, 'Aroostook')
|
farm | SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1 | Show the official names of the cities that have hosted more than one competition. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Aroostook',)
|
farm | SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1 | What are the official names of cities that have hosted more than one competition? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Aroostook',)
|
farm | SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1 | Show the status of the city that has hosted the greatest number of competitions. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Village',)
|
farm | SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1 | What is the status of the city that has hosted the most competitions? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Village',)
|
farm | SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000 | Please show the themes of competitions with host cities having populations larger than 1000. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Carnival M is back!',)
('Codehunters',)
('MTV Asia Aid',)
|
farm | SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000 | What are the themes of competitions that have corresponding host cities with more than 1000 residents? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Carnival M is back!',)
('Codehunters',)
('MTV Asia Aid',)
|
farm | SELECT Status , avg(Population) FROM city GROUP BY Status | Please show the different statuses of cities and the average population of cities with each status. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Town', 5706.0)
('Village', 1009.75)
|
farm | SELECT Status , avg(Population) FROM city GROUP BY Status | What are the statuses and average populations of each city? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Town', 5706.0)
('Village', 1009.75)
|
farm | SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC | Please show the different statuses, ordered by the number of cities that have each. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Town',)
('Village',)
|
farm | SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC | Return the different statuses of cities, ascending by frequency. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Town',)
('Village',)
|
farm | SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1 | List the most common type of Status across cities. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Village',)
|
farm | SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1 | What is the most common status across all cities? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Village',)
|
farm | SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition) | List the official names of cities that have not held any competition. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| |
farm | SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition) | What are the official names of cities that have not hosted a farm competition? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| |
farm | SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500 | Show the status shared by cities with population bigger than 1500 and smaller than 500. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Village',)
|
farm | SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500 | Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Village',)
|
farm | SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500 | Find the official names of cities with population bigger than 1500 or smaller than 500. |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Grand Falls/Grand-Sault',)
('Perth-Andover',)
('Aroostook',)
|
farm | SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500 | What are the official names of cities that have population over 1500 or less than 500? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('Grand Falls/Grand-Sault',)
('Perth-Andover',)
('Aroostook',)
|
farm | SELECT Census_Ranking FROM city WHERE Status != "Village" | Show the census ranking of cities whose status are not "Village". |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('636 of 5008',)
|
farm | SELECT Census_Ranking FROM city WHERE Status != "Village" | What are the census rankings of cities that do not have the status "Village"? |
PRAGMA foreign_keys = ON;
CREATE TABLE "city" (
"City_ID" int,
"Official_Name" text,
"Status" text,
"Area_km_2" real,
"Population" real,
"Census_Ranking" text,
PRIMARY KEY ("City_ID")
);
CREATE TABLE "farm" (
"Farm_ID" int,
"Year" int,
"Total_Horses" real,
"Working_Horses" real,
"Total_Cattle" real,
"Oxen" real,
"Bulls" real,
"Cows" real,
"Pigs" real,
"Sheep_and_Goats" real,
PRIMARY KEY ("Farm_ID")
);
CREATE TABLE "farm_competition" (
"Competition_ID" int,
"Year" int,
"Theme" text,
"Host_city_ID" int,
"Hosts" text,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)
);
CREATE TABLE "competition_record" (
"Competition_ID" int,
"Farm_ID" int,
"Rank" int,
PRIMARY KEY ("Competition_ID","Farm_ID"),
FOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),
FOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)
);
INSERT INTO "city" VALUES (1,"Grand Falls/Grand-Sault","Town","18.06","5706","636 of 5008");
INSERT INTO "city" VALUES (2,"Perth-Andover","Village","8.89","1778","1442 of 5,008");
INSERT INTO "city" VALUES (3,"Plaster Rock","Village","3.09","1135","1936 of 5,008");
INSERT INTO "city" VALUES (4,"Drummond","Village","8.91","775","2418 of 5008");
INSERT INTO "city" VALUES (5,"Aroostook","Village","2.24","351","3460 of 5008");
INSERT INTO "farm" VALUES (1,"1927","5056.5","3900.1","8374.5","805.5","31.6","3852.1","4412.4","7956.3");
INSERT INTO "farm" VALUES (2,"1928","5486.9","4090.5","8604.8","895.3","32.8","3987.0","6962.9","8112.2");
INSERT INTO "farm" VALUES (3,"1929","5607.5","4198.8","7611.0","593.7","26.9","3873.0","4161.2","7030.8");
INSERT INTO "farm" VALUES (4,"1930","5308.2","3721.6","6274.1","254.8","49.6","3471.6","3171.8","4533.4");
INSERT INTO "farm" VALUES (5,"1931","4781.3","3593.7","6189.5","113.8","40.0","3377.0","3373.3","3364.8");
INSERT INTO "farm" VALUES (6,"1932","3658.9","3711.6","5006.7","105.2","71.6","2739.5","2623.7","2109.5");
INSERT INTO "farm" VALUES (7,"1933","2604.8","3711.2","4446.3","116.9","37.6","2407.2","2089.2","2004.7");
INSERT INTO "farm" VALUES (8,"1934","2546.9","2197.3","5277.5","156.5","46.7","2518.0","4236.7","2197.1");
INSERT INTO "farm_competition" VALUES (1,"2013","Carnival M is back!",1,"Miley Cyrus Jared Leto and Karen Mok");
INSERT INTO "farm_competition" VALUES (2,"2006","Codehunters",2,"Leehom Wang and Kelly Rowland");
INSERT INTO "farm_competition" VALUES (3,"2005","MTV Asia Aid",3,"Alicia Keys");
INSERT INTO "farm_competition" VALUES (4,"2004","Valentine's Day",4,"Vanness Wu and Michelle Branch");
INSERT INTO "farm_competition" VALUES (5,"2003","MTV Cube",5,"Shaggy and Coco Lee");
INSERT INTO "farm_competition" VALUES (6,"2002","Aliens",5,"Mandy Moore and Ronan Keating");
INSERT INTO "competition_record" VALUES (1,8,1);
INSERT INTO "competition_record" VALUES (1,2,2);
INSERT INTO "competition_record" VALUES (1,3,3);
INSERT INTO "competition_record" VALUES (2,1,3);
INSERT INTO "competition_record" VALUES (2,4,1);
INSERT INTO "competition_record" VALUES (2,3,2);
INSERT INTO "competition_record" VALUES (3,7,1);
INSERT INTO "competition_record" VALUES (3,1,3);
INSERT INTO "competition_record" VALUES (4,3,2);
INSERT INTO "competition_record" VALUES (4,1,4);
INSERT INTO "competition_record" VALUES (5,5,1);
INSERT INTO "competition_record" VALUES (5,3,2);
| ('636 of 5008',)
|
student_assessment | SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) DESC LIMIT 1 | which course has most number of registered students? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('statistics',)
|
student_assessment | SELECT T1.course_name FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_Id GROUP BY T1.course_id ORDER BY count(*) DESC LIMIT 1 | What is the name of the course with the most registered students? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('statistics',)
|
student_assessment | SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1 | what is id of students who registered some courses but the least number of courses in these students? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
|
student_assessment | SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1 | What are the ids of the students who registered for some courses but had the least number of courses for all students? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
|
student_assessment | SELECT T2.first_name , T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id | what are the first name and last name of all candidates? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Shannon', 'Senger')
('Virginie', 'Hartmann')
('Dariana', 'Bednar')
('Verna', 'Grant')
('Hoyt', 'Wintheiser')
('Mayra', 'Hartmann')
('Lizeth', 'Bartoletti')
('Nova', 'Feest')
|
student_assessment | SELECT T2.first_name , T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id | What are the first and last names of all the candidates? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Shannon', 'Senger')
('Virginie', 'Hartmann')
('Dariana', 'Bednar')
('Verna', 'Grant')
('Hoyt', 'Wintheiser')
('Mayra', 'Hartmann')
('Lizeth', 'Bartoletti')
('Nova', 'Feest')
|
student_assessment | SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance) | List the id of students who never attends courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (131,)
(181,)
|
student_assessment | SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance) | What are the ids of every student who has never attended a course? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (131,)
(181,)
|
student_assessment | SELECT student_id FROM student_course_attendance | List the id of students who attended some courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(121,)
(141,)
(141,)
(151,)
(161,)
(171,)
|
student_assessment | SELECT student_id FROM student_course_attendance | What are the ids of all students who have attended at least one course? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(121,)
(141,)
(141,)
(151,)
(161,)
(171,)
|
student_assessment | SELECT T1.student_id , T2.course_name FROM student_course_registrations AS T1 JOIN courses AS T2 ON T1.course_id = T2.course_id | What are the ids of all students for courses and what are the names of those courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111, 'statistics')
(121, 'statistics')
(141, 'statistics')
(171, 'statistics')
(141, 'English')
(161, 'English')
(121, 'French')
(131, 'French')
(151, 'data structure')
|
student_assessment | SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1 | What is detail of the student who most recently registered course? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Martin',)
|
student_assessment | SELECT T2.student_details FROM student_course_registrations AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.registration_date DESC LIMIT 1 | What details do we have on the students who registered for courses most recently? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Martin',)
|
student_assessment | SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English" | How many students attend course English? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (2,)
|
student_assessment | SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English" | How many students are attending English courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (2,)
|
student_assessment | SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171 | How many courses do the student whose id is 171 attend? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (1,)
|
student_assessment | SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171 | How many courses does the student with id 171 actually attend? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (1,)
|
student_assessment | SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "[email protected]" | Find id of the candidate whose email is [email protected]? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (151,)
|
student_assessment | SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "[email protected]" | What is the id of the candidate whose email is [email protected]? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (151,)
|
student_assessment | SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1 | Find id of the candidate who most recently accessed the course? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (121,)
|
student_assessment | SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1 | What is the id of the candidate who most recently accessed the course? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (121,)
|
student_assessment | SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1 | What is detail of the student who registered the most number of courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Martin',)
|
student_assessment | SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1 | What are the details of the student who registered for the most number of courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Martin',)
|
student_assessment | SELECT T1.student_id , count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id | List the id of students who registered some courses and the number of their registered courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111, 1)
(121, 2)
(131, 1)
(141, 2)
(151, 1)
(161, 1)
(171, 1)
|
student_assessment | SELECT T1.student_id , count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id | For every student who is registered for some course, how many courses are they registered for? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111, 1)
(121, 2)
(131, 1)
(141, 2)
(151, 1)
(161, 1)
(171, 1)
|
student_assessment | SELECT T3.course_name , count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id | How many registed students do each course have? List course name and the number of their registered students? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('statistics', 4)
('English', 2)
('French', 2)
('data structure', 1)
|
student_assessment | SELECT T3.course_name , count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id | For each course id, how many students are registered and what are the course names? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('statistics', 4)
('English', 2)
('French', 2)
('data structure', 1)
|
student_assessment | SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass" | Find id of candidates whose assessment code is "Pass"? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(141,)
(151,)
|
student_assessment | SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass" | What are the ids of the candidates that have an outcome code of Pass? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(141,)
(151,)
|
student_assessment | SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail" | Find the cell mobile number of the candidates whose assessment code is "Fail"? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('(262)347-9364x516',)
|
student_assessment | SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail" | What are the cell phone numbers of the candidates that received an assessment code of "Fail"? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('(262)347-9364x516',)
|
student_assessment | SELECT student_id FROM student_course_attendance WHERE course_id = 301 | What are the id of students who registered course 301? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(141,)
(171,)
|
student_assessment | SELECT student_id FROM student_course_attendance WHERE course_id = 301 | What are the ids of the students who registered for course 301? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(141,)
(171,)
|
student_assessment | SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1 | What is the id of the student who most recently registered course 301? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (171,)
|
student_assessment | SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1 | What are the ids of the students who registered for course 301 most recently? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (171,)
|
student_assessment | SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id | Find distinct cities of addresses of people? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('South Minnie',)
('Linnealand',)
('East Tavaresburgh',)
('Terencetown',)
('Lake Devon',)
("O'Connellview",)
('New Alta',)
('South Naomibury',)
|
student_assessment | SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id | What are the different cities where people live? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('South Minnie',)
('Linnealand',)
('East Tavaresburgh',)
('Terencetown',)
('Lake Devon',)
("O'Connellview",)
('New Alta',)
('South Naomibury',)
|
student_assessment | SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id | Find distinct cities of address of students? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('South Minnie',)
('Linnealand',)
('East Tavaresburgh',)
('Terencetown',)
('Lake Devon',)
("O'Connellview",)
('New Alta',)
('South Naomibury',)
|
student_assessment | SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id | What are the different cities where students live? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('South Minnie',)
('Linnealand',)
('East Tavaresburgh',)
('Terencetown',)
('Lake Devon',)
("O'Connellview",)
('New Alta',)
('South Naomibury',)
|
student_assessment | SELECT course_name FROM courses ORDER BY course_name | List the names of courses in alphabetical order? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Art history',)
('English',)
('French',)
('data structure',)
('database',)
('statistics',)
|
student_assessment | SELECT course_name FROM courses ORDER BY course_name | What are the names of the courses in alphabetical order? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Art history',)
('English',)
('French',)
('data structure',)
('database',)
('statistics',)
|
student_assessment | SELECT first_name FROM people ORDER BY first_name | List the first names of people in alphabetical order? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Dariana',)
('Hoyt',)
('Lizeth',)
('Mayra',)
('Nova',)
('Shannon',)
('Verna',)
('Virginie',)
|
student_assessment | SELECT first_name FROM people ORDER BY first_name | What are the first names of the people in alphabetical order? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| ('Dariana',)
('Hoyt',)
('Lizeth',)
('Mayra',)
('Nova',)
('Shannon',)
('Verna',)
('Virginie',)
|
student_assessment | SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance | What are the id of students who registered courses or attended courses? | PRAGMA foreign_keys = ON;
CREATE TABLE Addresses (
address_id INTEGER NOT NULL,
line_1 VARCHAR(80),
line_2 VARCHAR(80),
city VARCHAR(50),
zip_postcode CHAR(20),
state_province_county VARCHAR(50),
country VARCHAR(50),
PRIMARY KEY (address_id)
);
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (5, '0900 Roderick Oval
New Albina, WA 19200-7914', 'Suite 096', 'Linnealand', '862', 'Montana', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (9, '966 Dach Ports Apt. 322
Lake Harmonyhaven, VA 65235', 'Apt. 163', 'South Minnie', '716', 'Texas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (29, '28550 Broderick Underpass Suite 667
Zakaryhaven, WY 22945-1534', 'Apt. 419', 'North Trystanborough', '112', 'Vermont', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (30, '83706 Ana Trafficway Apt. 992
West Jarret, MI 01112', 'Apt. 884', 'Lake Kaley', '431', 'Washington', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (43, '69165 Beatty Station
Haleighstad, MS 55164', 'Suite 333', 'Stephaniemouth', '559', 'Massachusetts', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (45, '242 Pacocha Streets
East Isabellashire, ND 03506', 'Suite 370', 'O''Connellview', '514', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (55, '801 Modesto Island Suite 306
Lacyville, VT 34059', 'Suite 764', 'New Alta', '176', 'Mississippi', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (63, '0177 Fisher Dam
Berniershire, KS 00038-7574', 'Apt. 903', 'South Keenan', '613', 'Michigan', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (68, '09471 Hickle Light
Port Maxime, NJ 91550-5409', 'Suite 903', 'Hannahside', '354', 'Connecticut', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (73, '67831 Lavonne Lodge
Olsontown, DC 20894', 'Apt. 756', 'Alizeshire', '687', 'NewMexico', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (82, '228 Fahey Land
Baileymouth, FL 06297-5606', 'Suite 087', 'South Naomibury', '079', 'Ohio', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (88, '1770 Adriel Ramp Apt. 397
West Ashlynnchester, UT 91968', 'Apt. 617', 'East Tavaresburgh', '179', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (92, '8760 Eldon Squares Suite 260
Marquisestad, GA 38537', 'Apt. 435', 'Lake Devon', '244', 'SouthDakota', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (94, '8263 Abbott Crossing Apt. 066
Oberbrunnerbury, LA 67451', 'Apt. 626', 'Boyleshire', '536', 'Kansas', 'USA');
INSERT INTO Addresses (`address_id`, `line_1`, `line_2`, `city`, `zip_postcode`, `state_province_county`, `country`) VALUES (99, '521 Paucek Field
North Oscartown, WI 31527', 'Apt. 849', 'Terencetown', '979', 'Michigan', 'USA');
CREATE TABLE People (
person_id INTEGER NOT NULL,
first_name VARCHAR(255),
middle_name VARCHAR(255),
last_name VARCHAR(255),
cell_mobile_number VARCHAR(40),
email_address VARCHAR(40),
login_name VARCHAR(40),
password VARCHAR(40),
PRIMARY KEY (person_id)
);
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (111, 'Shannon', 'Elissa', 'Senger', '01955267735', '[email protected]', 'pgub', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (131, 'Dariana', 'Hayley', 'Bednar', '(262)347-9364x516', '[email protected]', 'zops', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (121, 'Virginie', 'Jasmin', 'Hartmann', '(508)319-2970x043', '[email protected]', 'bkkv', 'b063331ea8116befaa7b84c59c6a22200f5f8caa');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (141, 'Verna', 'Arielle', 'Grant', '1-372-548-7538x314', '[email protected]', 'uuol', '7be9c03d5467d563555c51ebb3eb78e7f90832ec');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (151, 'Hoyt', 'Mercedes', 'Wintheiser', '1-603-110-0647', '[email protected]', 'bnto', 'c55795df86182959094b83e27900f7cf44ced570');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (161, 'Mayra', 'Haley', 'Hartmann', '724-681-4161x51632', '[email protected]', 'rzxu', 'ecae473cb54601e01457078ac0cdf4a1ced837bb');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (171, 'Lizeth', 'Bell', 'Bartoletti', '812.228.0645x91481', '[email protected]', 'mkou', '76a93d1d3b7becc932d203beac61d064bd54e947');
INSERT INTO People (`person_id`, `first_name`, `middle_name`, `last_name`, `cell_mobile_number`, `email_address`, `login_name`, `password`) VALUES (181, 'Nova', 'Amiya', 'Feest', '766-272-9964', '[email protected]', 'qrwl', '7dce9b688636ee212294c257dd2f6b85c7f65f2e');
CREATE TABLE Students (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY (student_id) REFERENCES People (person_id)
);
INSERT INTO Students (`student_id`,`student_details`) VALUES (111,'Marry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (121,'Martin');
INSERT INTO Students (`student_id`,`student_details`) VALUES (131,'Barry');
INSERT INTO Students (`student_id`,`student_details`) VALUES (141,'Nikhil');
INSERT INTO Students (`student_id`,`student_details`) VALUES (151,'John');
INSERT INTO Students (`student_id`,`student_details`) VALUES (161,'Sarah');
INSERT INTO Students (`student_id`,`student_details`) VALUES (171,'Joe');
INSERT INTO Students (`student_id`,`student_details`) VALUES (181,'Nancy');
CREATE TABLE Courses (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
);
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('301', 'statistics', 'statistics');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('302', 'English', 'English');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('303', 'French', 'French');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('304', 'database', 'database');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('305', 'data structure', 'data structure');
INSERT INTO Courses (`course_id`, `course_name`, `course_description`) VALUES ('306', 'Art history', 'Art history');
CREATE TABLE People_Addresses (
person_address_id INTEGER NOT NULL,
person_id INTEGER NOT NULL,
address_id INTEGER NOT NULL,
date_from DATETIME,
date_to DATETIME,
PRIMARY KEY (person_address_id),
FOREIGN KEY (person_id) REFERENCES People (person_id),
FOREIGN KEY (address_id) REFERENCES Addresses (address_id)
);
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (122, 111, 9, '2012-09-26 13:21:00', '2018-03-21 09:46:30');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (257, 121, 5, '2008-07-31 02:17:25', '2018-03-09 02:11:12');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (269, 131, 88, '2008-05-26 20:43:41', '2018-03-11 20:26:41');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (276, 141, 99, '2014-05-10 00:32:31', '2018-03-08 06:16:47');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (281, 151, 92, '2010-11-26 05:21:12', '2018-03-12 21:10:02');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (340, 161, 45, '2017-05-01 17:32:26', '2018-03-09 08:45:06');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (363, 171, 55, '2015-05-24 16:14:12', '2018-02-23 22:44:18');
INSERT INTO People_Addresses (`person_address_id`, `person_id`, `address_id`, `date_from`, `date_to`) VALUES (396, 181, 82, '2013-12-26 16:57:01', '2018-03-03 16:06:17');
CREATE TABLE Student_Course_Registrations (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
registration_date DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id) REFERENCES Students (student_id),
FOREIGN KEY (course_id) REFERENCES Courses (course_id)
);
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'301','2008-10-04 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (121,'303','2008-11-14 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (131,'303','2008-11-05 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'302','2008-11-06 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (151,'305','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (161,'302','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (171,'301','2008-11-07 10:35:13');
INSERT INTO Student_Course_Registrations (`student_id`,`course_id`,`registration_date`) VALUES (141,'301','2008-11-08 10:35:13');
CREATE TABLE Student_Course_Attendance (
student_id INTEGER NOT NULL,
course_id INTEGER NOT NULL,
date_of_attendance DATETIME NOT NULL,
PRIMARY KEY (student_id, course_id),
FOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)
);
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (111,'301','2008-11-04 10:35:13');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'301','2012-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (121,'303','2014-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'302','2013-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (171,'301','2015-04-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (161,'302','2014-01-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (151,'305','2012-05-09 11:44:34');
INSERT INTO Student_Course_Attendance (`student_id`,`course_id`,`date_of_attendance`) VALUES (141,'301','2012-09-09 11:44:34');
CREATE TABLE Candidates (
candidate_id INTEGER NOT NULL ,
candidate_details VARCHAR(255),
PRIMARY KEY (candidate_id),
FOREIGN KEY (candidate_id) REFERENCES People (person_id)
);
CREATE TABLE Candidate_Assessments (
candidate_id INTEGER NOT NULL,
qualification CHAR(15) NOT NULL,
assessment_date DATETIME NOT NULL,
asessment_outcome_code CHAR(15) NOT NULL,
PRIMARY KEY (candidate_id, qualification),
FOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)
);
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (111,'Jane');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (121,'Robert');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (131,'Alex');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (141,'Tao');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (151,'Jack');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (161,'Leo');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (171,'Robin');
INSERT INTO Candidates (`candidate_id`,`candidate_details`) VALUES (181,'Cindy');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (111,'A','2010-04-07 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (121,'B','2010-04-17 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (131,'D','2010-04-05 11:44:34','Fail');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (141,'C','2010-04-06 11:44:34','Pass');
INSERT INTO Candidate_Assessments (`candidate_id`,`qualification`,`assessment_date`,`asessment_outcome_code`) VALUES (151,'B','2010-04-09 11:44:34','Pass');
| (111,)
(121,)
(131,)
(141,)
(151,)
(161,)
(171,)
|