db_id
stringclasses 146
values | schema
stringclasses 146
values | question_en
stringlengths 3
224
| hardness
stringclasses 4
values | schema_llm
stringclasses 146
values | query_llm
stringlengths 18
631
| selector
stringlengths 18
266
| schema_llm_ct
stringclasses 147
values | schema_llm_columns_min
stringclasses 147
values | schema_llm_columns_min_ct
stringclasses 147
values | schema_llm_all_min
stringclasses 147
values | schema_llm_all_min_ct
stringclasses 147
values | schema_dict
stringclasses 146
values | selector_correct
stringlengths 20
266
| schema_llm_t
stringclasses 147
values | schema_llm_columns_min_t
stringclasses 147
values | schema_llm_all_min_t
stringclasses 147
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | How many heads of the departments are older than 56 ? | easy | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT count(*) FROM head WHERE age > 56 | {
'head': ['head_id', 'age']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'head': ['head_ID', 'age']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | List the name, born state and age of the heads of departments ordered by age. | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT name , born_state , age FROM head ORDER BY age | {
'head': ['head_id', 'name', 'born_state', 'age']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'head': ['head_ID', 'name', 'born_state', 'age']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | List the creation year, name and budget of each department. | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT creation , name , budget_in_billions FROM department | {
'department': ['department_id', 'name', 'creation', 'budget_in_billions']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Name', 'Creation', 'Budget_in_Billions']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | What are the maximum and minimum budget of the departments? | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT max(budget_in_billions) , min(budget_in_billions) FROM department | {
'department': ['department_id', 'budget_in_billions']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Budget_in_Billions']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | What is the average number of employees of the departments whose rank is between 10 and 15? | easy | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15 | {
'department': ['department_id', 'ranking', 'num_employees']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Ranking', 'Num_Employees']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | What are the names of the heads who are born outside the California state? | easy | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT name FROM head WHERE born_state != 'California' | {
'head': ['head_id', 'name', 'born_state']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'head': ['head_ID', 'name', 'born_state']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? | hard | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT DISTINCT department.creation FROM department JOIN management ON department.department_id = management.department_id JOIN head ON management.head_id = head.head_id WHERE head.born_state = 'Alabama' | {
'department': ['department_id', 'creation'],
'management': ['department_id', 'head_id'],
'head': ['head_id', 'born_state']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Creation'],
'management': ['department_ID', 'head_ID'],
'head': ['head_ID', 'born_state']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | What are the names of the states where at least 3 heads were born? | easy | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3 | {
'head': ['head_id', 'born_state']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'head': ['head_ID', 'born_state']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | In which year were most departments established? | hard | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1 | {
'department': ['department_id', 'creation']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Creation']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT department.name , department.num_employees FROM department JOIN management ON department.department_id = management.department_id WHERE management.temporary_acting = 'Yes' | {
'department': ['department_id', 'name', 'num_employees'],
'management': ['department_id', 'temporary_acting']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Name', 'Num_Employees'],
'management': ['department_ID', 'temporary_acting']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | How many acting statuses are there? | easy | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT count(DISTINCT temporary_acting) FROM management | {
'management': ['department_id', 'temporary_acting']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'management': ['department_ID', 'temporary_acting']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | How many departments are led by heads who are not mentioned? | extra | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management); | {
'department': ['department_id'],
'management': ['department_id']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID'],
'management': ['department_ID']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | What are the distinct ages of the heads who are acting? | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT DISTINCT head.age FROM management JOIN head ON head.head_id = management.head_id WHERE management.temporary_acting = 'Yes' | {
'management': ['department_id', 'head_id', 'temporary_acting'],
'head': ['head_id', 'age']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'management': ['department_ID', 'head_ID', 'temporary_acting'],
'head': ['head_ID', 'age']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. | extra | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT head.born_state FROM department JOIN management ON department.department_id = management.department_id JOIN head ON management.head_id = head.head_id WHERE department.name = 'Treasury' INTERSECT SELECT head.born_state FROM department JOIN management ON department.department_id = management.department_id JOIN head ON management.head_id = head.head_id WHERE department.name = 'Homeland Security' | {
'department': ['department_id', 'name'],
'management': ['department_id', 'head_id'],
'head': ['head_id', 'born_state']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'department': ['Department_ID', 'Name'],
'management': ['department_ID', 'head_ID'],
'head': ['head_ID', 'born_state']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | Which department has more than 1 head at a time? List the id, name and the number of heads. | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT department.department_id , department.name , count(*) FROM management JOIN department ON department.department_id = management.department_id GROUP BY department.department_id HAVING count(*) > 1 | {
'management': ['department_id'],
'department': ['department_id', 'name']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'management': ['department_ID'],
'department': ['Department_ID', 'Name']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
department_management |
CREATE TABLE department (
"Department_ID" INTEGER,
"Name" TEXT,
"Creation" TEXT,
"Ranking" INTEGER,
"Budget_in_Billions" REAL,
"Num_Employees" REAL,
PRIMARY KEY ("Department_ID")
)
CREATE TABLE head (
"head_ID" INTEGER,
name TEXT,
born_state TEXT,
age REAL,
PRIMARY KEY ("head_ID")
)
CREATE TABLE management (
"department_ID" INTEGER,
"head_ID" INTEGER,
temporary_acting TEXT,
PRIMARY KEY ("department_ID", "head_ID"),
FOREIGN KEY("head_ID") REFERENCES head ("head_ID"),
FOREIGN KEY("department_ID") REFERENCES department ("Department_ID")
) | Which head's name has the substring 'Ha'? List the id and name. | medium | Table department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
Table head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| SELECT head_id , name FROM head WHERE name LIKE '%Ha%' | {
'head': ['head_id', 'name']
} | CREATE TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
CREATE TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| Table department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
Table head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
Table management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| CREATE TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
CREATE TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
CREATE TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| {
'department': ['Department_ID', 'Name', 'Creation', 'Ranking', 'Budget_in_Billions', 'Num_Employees'],
'head': ['head_ID', 'name', 'born_state', 'age'],
'management': ['department_ID', 'head_ID', 'temporary_acting']
} | {
'head': ['head_ID', 'name']
} | TABLE department (
department.Department_ID (INT),
department.Name (TEXT),
department.Creation (TEXT),
department.Ranking (INT),
department.Budget_in_Billions (REAL),
department.Num_Employees (REAL),
)
TABLE head (
head.head_ID (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_ID (INT),
management.head_ID (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_ID = department.Department_ID
management.head_ID = head.head_ID
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
| TABLE department (
department.department_id (INT),
department.name (TEXT),
department.creation (TEXT),
department.ranking (INT),
department.budget_in_billions (REAL),
department.num_employees (REAL),
)
TABLE head (
head.head_id (INT),
head.name (TEXT),
head.born_state (TEXT),
head.age (REAL),
)
TABLE management (
management.department_id (INT),
management.head_id (INT),
management.temporary_acting (TEXT),
)
Possible JOINs:
management.department_id = department.department_id
management.head_id = head.head_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | How many farms are there? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT count(*) FROM farm | {
'farm': ['farm_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Count the number of farms. | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT count(*) FROM farm | {
'farm': ['farm_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | List the total number of horses on farms in ascending order. | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC | {
'farm': ['farm_id', 'total_horses']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID', 'Total_Horses']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What is the total horses record for each farm, sorted ascending? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC | {
'farm': ['farm_id', 'total_horses']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID', 'Total_Horses']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the hosts of competitions whose theme is not "Aliens"? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens' | {
'farm_competition': ['competition_id', 'theme', 'hosts']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm_competition': ['Competition_ID', 'Theme', 'Hosts']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Return the hosts of competitions for which the theme is not Aliens? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens' | {
'farm_competition': ['competition_id', 'theme', 'hosts']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm_competition': ['Competition_ID', 'Theme', 'Hosts']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the themes of farm competitions sorted by year in ascending order? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Theme FROM farm_competition ORDER BY YEAR ASC | {
'farm_competition': ['competition_id', 'year', 'theme']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm_competition': ['Competition_ID', 'Year', 'Theme']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Return the themes of farm competitions, sorted by year ascending. | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Theme FROM farm_competition ORDER BY YEAR ASC | {
'farm_competition': ['competition_id', 'year', 'theme']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm_competition': ['Competition_ID', 'Year', 'Theme']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What is the average number of working horses of farms with more than 5000 total number of horses? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000 | {
'farm': ['farm_id', 'total_horses', 'working_horses']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID', 'Total_Horses', 'Working_Horses']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Give the average number of working horses on farms with more than 5000 total horses. | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000 | {
'farm': ['farm_id', 'total_horses', 'working_horses']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID', 'Total_Horses', 'Working_Horses']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the maximum and minimum number of cows across all farms. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT max(Cows) , min(Cows) FROM farm | {
'farm': ['farm_id', 'cows']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID', 'Cows']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Return the maximum and minimum number of cows across all farms. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT max(Cows) , min(Cows) FROM farm | {
'farm': ['farm_id', 'cows']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'farm': ['Farm_ID', 'Cows']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | How many different statuses do cities have? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT count(DISTINCT Status) FROM city | {
'city': ['city_id', 'status']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Count the number of different statuses. | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT count(DISTINCT Status) FROM city | {
'city': ['city_id', 'status']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | List official names of cities in descending order of population. | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name FROM city ORDER BY Population DESC | {
'city': ['city_id', 'official_name', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the official names of cities, ordered descending by population? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name FROM city ORDER BY Population DESC | {
'city': ['city_id', 'official_name', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | List the official name and status of the city with the largest population. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1 | {
'city': ['city_id', 'official_name', 'status', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name', 'Status', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What is the official name and status of the city with the most residents? | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1 | {
'city': ['city_id', 'official_name', 'status', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name', 'Status', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Show the years and the official names of the host cities of competitions. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT farm_competition.Year , city.Official_Name FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID | {
'city': ['city_id', 'official_name'],
'farm_competition': ['competition_id', 'year', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name'],
'farm_competition': ['Competition_ID', 'Year', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Give the years and official names of the cities of each competition. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT farm_competition.Year , city.Official_Name FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID | {
'city': ['city_id', 'official_name'],
'farm_competition': ['competition_id', 'year', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name'],
'farm_competition': ['Competition_ID', 'Year', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Show the official names of the cities that have hosted more than one competition. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT city.Official_Name FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID GROUP BY farm_competition.Host_city_ID HAVING COUNT(*) > 1 | {
'city': ['city_id', 'official_name'],
'farm_competition': ['competition_id', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name'],
'farm_competition': ['Competition_ID', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the official names of cities that have hosted more than one competition? | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT city.Official_Name FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID GROUP BY farm_competition.Host_city_ID HAVING COUNT(*) > 1 | {
'city': ['city_id', 'official_name'],
'farm_competition': ['competition_id', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name'],
'farm_competition': ['Competition_ID', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Show the status of the city that has hosted the greatest number of competitions. | extra | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT city.Status FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID GROUP BY farm_competition.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1 | {
'city': ['city_id', 'status'],
'farm_competition': ['competition_id', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status'],
'farm_competition': ['Competition_ID', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What is the status of the city that has hosted the most competitions? | extra | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT city.Status FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID GROUP BY farm_competition.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1 | {
'city': ['city_id', 'status'],
'farm_competition': ['competition_id', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status'],
'farm_competition': ['Competition_ID', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Please show the themes of competitions with host cities having populations larger than 1000. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT farm_competition.Theme FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID WHERE city.Population > 1000 | {
'city': ['city_id', 'population'],
'farm_competition': ['competition_id', 'theme', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Population'],
'farm_competition': ['Competition_ID', 'Theme', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the themes of competitions that have corresponding host cities with more than 1000 residents? | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT farm_competition.Theme FROM city JOIN farm_competition ON city.City_ID = farm_competition.Host_city_ID WHERE city.Population > 1000 | {
'city': ['city_id', 'population'],
'farm_competition': ['competition_id', 'theme', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Population'],
'farm_competition': ['Competition_ID', 'Theme', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Please show the different statuses of cities and the average population of cities with each status. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status , avg(Population) FROM city GROUP BY Status | {
'city': ['city_id', 'status', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the statuses and average populations of each city? | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status , avg(Population) FROM city GROUP BY Status | {
'city': ['city_id', 'status', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Please show the different statuses, ordered by the number of cities that have each. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC | {
'city': ['city_id', 'status']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Return the different statuses of cities, ascending by frequency. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) ASC | {
'city': ['city_id', 'status']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | List the most common type of Status across cities. | hard | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1 | {
'city': ['city_id', 'status']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What is the most common status across all cities? | hard | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status FROM city GROUP BY Status ORDER BY COUNT(*) DESC LIMIT 1 | {
'city': ['city_id', 'status']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | List the official names of cities that have not held any competition. | hard | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition) | {
'city': ['city_id', 'official_name'],
'farm_competition': ['competition_id', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name'],
'farm_competition': ['Competition_ID', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the official names of cities that have not hosted a farm competition? | hard | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name FROM city WHERE City_ID NOT IN (SELECT Host_city_ID FROM farm_competition) | {
'city': ['city_id', 'official_name'],
'farm_competition': ['competition_id', 'host_city_id']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name'],
'farm_competition': ['Competition_ID', 'Host_city_ID']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Show the status shared by cities with population bigger than 1500 and smaller than 500. | hard | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500 | {
'city': ['city_id', 'status', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500? | hard | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Status FROM city WHERE Population > 1500 INTERSECT SELECT Status FROM city WHERE Population < 500 | {
'city': ['city_id', 'status', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Find the official names of cities with population bigger than 1500 or smaller than 500. | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500 | {
'city': ['city_id', 'official_name', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the official names of cities that have population over 1500 or less than 500? | medium | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Official_Name FROM city WHERE Population > 1500 OR Population < 500 | {
'city': ['city_id', 'official_name', 'population']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Official_Name', 'Population']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | Show the census ranking of cities whose status are not "Village". | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Census_Ranking FROM city WHERE Status != "Village" | {
'city': ['city_id', 'status', 'census_ranking']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status', 'Census_Ranking']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
farm |
CREATE TABLE city (
"City_ID" INTEGER,
"Official_Name" TEXT,
"Status" TEXT,
"Area_km_2" REAL,
"Population" REAL,
"Census_Ranking" TEXT,
PRIMARY KEY ("City_ID")
)
CREATE TABLE competition_record (
"Competition_ID" INTEGER,
"Farm_ID" INTEGER,
"Rank" INTEGER,
PRIMARY KEY ("Competition_ID", "Farm_ID"),
FOREIGN KEY("Farm_ID") REFERENCES farm ("Farm_ID"),
FOREIGN KEY("Competition_ID") REFERENCES farm_competition ("Competition_ID")
)
CREATE TABLE farm (
"Farm_ID" INTEGER,
"Year" INTEGER,
"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" INTEGER,
"Year" INTEGER,
"Theme" TEXT,
"Host_city_ID" INTEGER,
"Hosts" TEXT,
PRIMARY KEY ("Competition_ID"),
FOREIGN KEY("Host_city_ID") REFERENCES city ("City_ID")
) | What are the census rankings of cities that do not have the status "Village"? | easy | Table city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
Table competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
Table farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
Table farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| SELECT Census_Ranking FROM city WHERE Status != "Village" | {
'city': ['city_id', 'status', 'census_ranking']
} | CREATE TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
CREATE TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| Table city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
Table competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
Table farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
Table farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| CREATE TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
CREATE TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
CREATE TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
CREATE TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| {
'city': ['City_ID', 'Official_Name', 'Status', 'Area_km_2', 'Population', 'Census_Ranking'],
'farm': ['Farm_ID', 'Year', 'Total_Horses', 'Working_Horses', 'Total_Cattle', 'Oxen', 'Bulls', 'Cows', 'Pigs', 'Sheep_and_Goats'],
'farm_competition': ['Competition_ID', 'Year', 'Theme', 'Host_city_ID', 'Hosts'],
'competition_record': ['Competition_ID', 'Farm_ID', 'Rank']
} | {
'city': ['City_ID', 'Status', 'Census_Ranking']
} | TABLE city (
city.City_ID (INT),
city.Official_Name (TEXT),
city.Status (TEXT),
city.Area_km_2 (REAL),
city.Population (REAL),
city.Census_Ranking (TEXT),
)
TABLE competition_record (
competition_record.Competition_ID (INT),
competition_record.Farm_ID (INT),
competition_record.Rank (INT),
)
TABLE farm (
farm.Farm_ID (INT),
farm.Year (INT),
farm.Total_Horses (REAL),
farm.Working_Horses (REAL),
farm.Total_Cattle (REAL),
farm.Oxen (REAL),
farm.Bulls (REAL),
farm.Cows (REAL),
farm.Pigs (REAL),
farm.Sheep_and_Goats (REAL),
)
TABLE farm_competition (
farm_competition.Competition_ID (INT),
farm_competition.Year (INT),
farm_competition.Theme (TEXT),
farm_competition.Host_city_ID (INT),
farm_competition.Hosts (TEXT),
)
Possible JOINs:
competition_record.Competition_ID = farm_competition.Competition_ID
competition_record.Farm_ID = farm.Farm_ID
farm_competition.Host_city_ID = city.City_ID
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
| TABLE city (
city.city_id (INT),
city.official_name (TEXT),
city.status (TEXT),
city.area_km_2 (REAL),
city.population (REAL),
city.census_ranking (TEXT),
)
TABLE competition_record (
competition_record.competition_id (INT),
competition_record.farm_id (INT),
competition_record.rank (INT),
)
TABLE farm (
farm.farm_id (INT),
farm.year (INT),
farm.total_horses (REAL),
farm.working_horses (REAL),
farm.total_cattle (REAL),
farm.oxen (REAL),
farm.bulls (REAL),
farm.cows (REAL),
farm.pigs (REAL),
farm.sheep_and_goats (REAL),
)
TABLE farm_competition (
farm_competition.competition_id (INT),
farm_competition.year (INT),
farm_competition.theme (TEXT),
farm_competition.host_city_id (INT),
farm_competition.hosts (TEXT),
)
Possible JOINs:
competition_record.competition_id = farm_competition.competition_id
competition_record.farm_id = farm.farm_id
farm_competition.host_city_id = city.city_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | which course has most number of registered students? | extra | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT courses.course_name FROM courses JOIN student_course_registrations ON courses.course_id = student_course_registrations.course_Id GROUP BY courses.course_id ORDER BY count(*) DESC LIMIT 1 | {
'courses': ['course_id', 'course_name'],
'student_course_registrations': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id', 'course_name'],
'Student_Course_Registrations': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What is the name of the course with the most registered students? | extra | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT courses.course_name FROM courses JOIN student_course_registrations ON courses.course_id = student_course_registrations.course_Id GROUP BY courses.course_id ORDER BY count(*) DESC LIMIT 1 | {
'courses': ['course_id', 'course_name'],
'student_course_registrations': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id', 'course_name'],
'Student_Course_Registrations': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | what is id of students who registered some courses but the least number of courses in these students? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1 | {
'student_course_registrations': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Registrations': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of the students who registered for some courses but had the least number of courses for all students? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1 | {
'student_course_registrations': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Registrations': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | what are the first name and last name of all candidates? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT people.first_name , people.last_name FROM candidates JOIN people ON candidates.candidate_id = people.person_id | {
'candidates': ['candidate_id'],
'people': ['person_id', 'first_name', 'last_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidates': ['candidate_id'],
'People': ['person_id', 'first_name', 'last_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the first and last names of all the candidates? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT people.first_name , people.last_name FROM candidates JOIN people ON candidates.candidate_id = people.person_id | {
'candidates': ['candidate_id'],
'people': ['person_id', 'first_name', 'last_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidates': ['candidate_id'],
'People': ['person_id', 'first_name', 'last_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | List the id of students who never attends courses? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance) | {
'students': ['student_id'],
'student_course_attendance': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id'],
'Student_Course_Attendance': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of every student who has never attended a course? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance) | {
'students': ['student_id'],
'student_course_attendance': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id'],
'Student_Course_Attendance': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | List the id of students who attended some courses? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_attendance | {
'student_course_attendance': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Attendance': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of all students who have attended at least one course? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_attendance | {
'student_course_attendance': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Attendance': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of all students for courses and what are the names of those courses? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_course_registrations.student_id , courses.course_name FROM student_course_registrations JOIN courses ON student_course_registrations.course_id = courses.course_id | {
'student_course_registrations': ['student_id', 'course_id'],
'courses': ['course_id', 'course_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Registrations': ['student_id', 'course_id'],
'Courses': ['course_id', 'course_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What is detail of the student who most recently registered course? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT students.student_details FROM student_course_registrations JOIN students ON student_course_registrations.student_id = students.student_id ORDER BY student_course_registrations.registration_date DESC LIMIT 1 | {
'student_course_registrations': ['student_id', 'registration_date'],
'students': ['student_id', 'student_details']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Registrations': ['student_id', 'registration_date'],
'Students': ['student_id', 'student_details']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What details do we have on the students who registered for courses most recently? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT students.student_details FROM student_course_registrations JOIN students ON student_course_registrations.student_id = students.student_id ORDER BY student_course_registrations.registration_date DESC LIMIT 1 | {
'student_course_registrations': ['student_id', 'registration_date'],
'students': ['student_id', 'student_details']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Registrations': ['student_id', 'registration_date'],
'Students': ['student_id', 'student_details']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | How many students attend course English? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT count(*) FROM courses JOIN student_course_attendance ON courses.course_id = student_course_attendance.course_id WHERE courses.course_name = "English" | {
'courses': ['course_id', 'course_name'],
'student_course_attendance': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id', 'course_name'],
'Student_Course_Attendance': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | How many students are attending English courses? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT count(*) FROM courses JOIN student_course_attendance ON courses.course_id = student_course_attendance.course_id WHERE courses.course_name = "English" | {
'courses': ['course_id', 'course_name'],
'student_course_attendance': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id', 'course_name'],
'Student_Course_Attendance': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | How many courses do the student whose id is 171 attend? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT count(*) FROM courses JOIN student_course_attendance ON courses.course_id = student_course_attendance.course_id WHERE student_course_attendance.student_id = 171 | {
'courses': ['course_id'],
'student_course_attendance': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id'],
'Student_Course_Attendance': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | How many courses does the student with id 171 actually attend? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT count(*) FROM courses JOIN student_course_attendance ON courses.course_id = student_course_attendance.course_id WHERE student_course_attendance.student_id = 171 | {
'courses': ['course_id'],
'student_course_attendance': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id'],
'Student_Course_Attendance': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | Find id of the candidate whose email is [email protected]? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT candidates.candidate_id FROM people JOIN candidates ON people.person_id = candidates.candidate_id WHERE people.email_address = "[email protected]" | {
'people': ['person_id', 'email_address'],
'candidates': ['candidate_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'People': ['person_id', 'email_address'],
'Candidates': ['candidate_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What is the id of the candidate whose email is [email protected]? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT candidates.candidate_id FROM people JOIN candidates ON people.person_id = candidates.candidate_id WHERE people.email_address = "[email protected]" | {
'people': ['person_id', 'email_address'],
'candidates': ['candidate_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'People': ['person_id', 'email_address'],
'Candidates': ['candidate_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | Find id of the candidate who most recently accessed the course? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1 | {
'candidate_assessments': ['candidate_id', 'assessment_date']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidate_Assessments': ['candidate_id', 'assessment_date']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What is the id of the candidate who most recently accessed the course? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1 | {
'candidate_assessments': ['candidate_id', 'assessment_date']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidate_Assessments': ['candidate_id', 'assessment_date']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What is detail of the student who registered the most number of courses? | extra | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT students.student_details FROM students JOIN student_course_registrations ON students.student_id = student_course_registrations.student_id GROUP BY students.student_id ORDER BY count(*) DESC LIMIT 1 | {
'students': ['student_id', 'student_details'],
'student_course_registrations': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id', 'student_details'],
'Student_Course_Registrations': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the details of the student who registered for the most number of courses? | extra | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT students.student_details FROM students JOIN student_course_registrations ON students.student_id = student_course_registrations.student_id GROUP BY students.student_id ORDER BY count(*) DESC LIMIT 1 | {
'students': ['student_id', 'student_details'],
'student_course_registrations': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id', 'student_details'],
'Student_Course_Registrations': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | List the id of students who registered some courses and the number of their registered courses? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT students.student_id , count(*) FROM students JOIN student_course_registrations ON students.student_id = student_course_registrations.student_id GROUP BY students.student_id | {
'students': ['student_id'],
'student_course_registrations': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id'],
'Student_Course_Registrations': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | For every student who is registered for some course, how many courses are they registered for? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT students.student_id , count(*) FROM students JOIN student_course_registrations ON students.student_id = student_course_registrations.student_id GROUP BY students.student_id | {
'students': ['student_id'],
'student_course_registrations': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id'],
'Student_Course_Registrations': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | How many registed students do each course have? List course name and the number of their registered students? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT courses.course_name , count(*) FROM students JOIN student_course_registrations ON students.student_id = student_course_registrations.student_id JOIN courses ON student_course_registrations.course_id = courses.course_id GROUP BY student_course_registrations.course_id | {
'students': ['student_id'],
'student_course_registrations': ['student_id', 'course_id'],
'courses': ['course_id', 'course_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id'],
'Student_Course_Registrations': ['student_id', 'course_id'],
'Courses': ['course_id', 'course_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | For each course id, how many students are registered and what are the course names? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT courses.course_name , count(*) FROM students JOIN student_course_registrations ON students.student_id = student_course_registrations.student_id JOIN courses ON student_course_registrations.course_id = courses.course_id GROUP BY student_course_registrations.course_id | {
'students': ['student_id'],
'student_course_registrations': ['student_id', 'course_id'],
'courses': ['course_id', 'course_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Students': ['student_id'],
'Student_Course_Registrations': ['student_id', 'course_id'],
'Courses': ['course_id', 'course_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | Find id of candidates whose assessment code is "Pass"? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass" | {
'candidate_assessments': ['candidate_id', 'asessment_outcome_code']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidate_Assessments': ['candidate_id', 'asessment_outcome_code']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of the candidates that have an outcome code of Pass? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass" | {
'candidate_assessments': ['candidate_id', 'asessment_outcome_code']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidate_Assessments': ['candidate_id', 'asessment_outcome_code']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | Find the cell mobile number of the candidates whose assessment code is "Fail"? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT people.cell_mobile_number FROM candidates JOIN candidate_assessments ON candidates.candidate_id = candidate_assessments.candidate_id JOIN people ON candidates.candidate_id = people.person_id WHERE candidate_assessments.asessment_outcome_code = "Fail" | {
'candidates': ['candidate_id'],
'candidate_assessments': ['candidate_id', 'asessment_outcome_code'],
'people': ['person_id', 'cell_mobile_number']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidates': ['candidate_id'],
'Candidate_Assessments': ['candidate_id', 'asessment_outcome_code'],
'People': ['person_id', 'cell_mobile_number']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the cell phone numbers of the candidates that received an assessment code of "Fail"? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT people.cell_mobile_number FROM candidates JOIN candidate_assessments ON candidates.candidate_id = candidate_assessments.candidate_id JOIN people ON candidates.candidate_id = people.person_id WHERE candidate_assessments.asessment_outcome_code = "Fail" | {
'candidates': ['candidate_id'],
'candidate_assessments': ['candidate_id', 'asessment_outcome_code'],
'people': ['person_id', 'cell_mobile_number']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Candidates': ['candidate_id'],
'Candidate_Assessments': ['candidate_id', 'asessment_outcome_code'],
'People': ['person_id', 'cell_mobile_number']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the id of students who registered course 301? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_attendance WHERE course_id = 301 | {
'student_course_attendance': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Attendance': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of the students who registered for course 301? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_attendance WHERE course_id = 301 | {
'student_course_attendance': ['student_id', 'course_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Attendance': ['student_id', 'course_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What is the id of the student who most recently registered course 301? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1 | {
'student_course_attendance': ['student_id', 'course_id', 'date_of_attendance']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the ids of the students who registered for course 301 most recently? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1 | {
'student_course_attendance': ['student_id', 'course_id', 'date_of_attendance']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | Find distinct cities of addresses of people? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT DISTINCT addresses.city FROM addresses JOIN people_addresses ON addresses.address_id = people_addresses.address_id | {
'addresses': ['address_id', 'city'],
'people_addresses': ['person_address_id', 'address_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Addresses': ['address_id', 'city'],
'People_Addresses': ['person_address_id', 'address_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the different cities where people live? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT DISTINCT addresses.city FROM addresses JOIN people_addresses ON addresses.address_id = people_addresses.address_id | {
'addresses': ['address_id', 'city'],
'people_addresses': ['person_address_id', 'address_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Addresses': ['address_id', 'city'],
'People_Addresses': ['person_address_id', 'address_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | Find distinct cities of address of students? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT DISTINCT addresses.city FROM addresses JOIN people_addresses ON addresses.address_id = people_addresses.address_id JOIN students ON people_addresses.person_id = students.student_id | {
'addresses': ['address_id', 'city'],
'people_addresses': ['person_address_id', 'person_id', 'address_id'],
'students': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Addresses': ['address_id', 'city'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id'],
'Students': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the different cities where students live? | medium | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT DISTINCT addresses.city FROM addresses JOIN people_addresses ON addresses.address_id = people_addresses.address_id JOIN students ON people_addresses.person_id = students.student_id | {
'addresses': ['address_id', 'city'],
'people_addresses': ['person_address_id', 'person_id', 'address_id'],
'students': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Addresses': ['address_id', 'city'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id'],
'Students': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | List the names of courses in alphabetical order? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT course_name FROM courses ORDER BY course_name | {
'courses': ['course_id', 'course_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id', 'course_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the names of the courses in alphabetical order? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT course_name FROM courses ORDER BY course_name | {
'courses': ['course_id', 'course_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Courses': ['course_id', 'course_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | List the first names of people in alphabetical order? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT first_name FROM people ORDER BY first_name | {
'people': ['person_id', 'first_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'People': ['person_id', 'first_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the first names of the people in alphabetical order? | easy | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT first_name FROM people ORDER BY first_name | {
'people': ['person_id', 'first_name']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'People': ['person_id', 'first_name']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|
student_assessment |
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)
)
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)
)
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 "Courses" (
course_id VARCHAR(100) NOT NULL,
course_name VARCHAR(120),
course_description VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (course_id)
)
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)
)
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)
)
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)
)
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)
)
CREATE TABLE "Students" (
student_id INTEGER NOT NULL,
student_details VARCHAR(255),
PRIMARY KEY (student_id),
FOREIGN KEY(student_id) REFERENCES "People" (person_id)
) | What are the id of students who registered courses or attended courses? | hard | Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance | {
'student_course_registrations': ['student_id'],
'student_course_attendance': ['student_id']
} | CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
Table Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
Table Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
Table Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
Table People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
Table People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
Table Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
Table Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
Table Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| CREATE TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
CREATE TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
CREATE TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
CREATE TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
CREATE TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
CREATE TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
CREATE TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| Table addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
Table candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
Table candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
Table courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
Table people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
Table people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
Table student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
Table student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
Table students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| CREATE TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
CREATE TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
CREATE TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
CREATE TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
CREATE TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
CREATE TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
CREATE TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
CREATE TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
CREATE TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
| {
'Addresses': ['address_id', 'line_1', 'line_2', 'city', 'zip_postcode', 'state_province_county', 'country'],
'People': ['person_id', 'first_name', 'middle_name', 'last_name', 'cell_mobile_number', 'email_address', 'login_name', 'password'],
'Students': ['student_id', 'student_details'],
'Courses': ['course_id', 'course_name', 'course_description', 'other_details'],
'People_Addresses': ['person_address_id', 'person_id', 'address_id', 'date_from', 'date_to'],
'Student_Course_Registrations': ['student_id', 'course_id', 'registration_date'],
'Student_Course_Attendance': ['student_id', 'course_id', 'date_of_attendance'],
'Candidates': ['candidate_id', 'candidate_details'],
'Candidate_Assessments': ['candidate_id', 'qualification', 'assessment_date', 'asessment_outcome_code']
} | {
'Student_Course_Registrations': ['student_id'],
'Student_Course_Attendance': ['student_id']
} | TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE Addresses (
Addresses.address_id (INTEGER),
Addresses.line_1 (VARCHAR(80)),
Addresses.line_2 (VARCHAR(80)),
Addresses.city (VARCHAR(50)),
Addresses.zip_postcode (CHAR(20)),
Addresses.state_province_county (VARCHAR(50)),
Addresses.country (VARCHAR(50)),
)
TABLE Candidate_Assessments (
Candidate_Assessments.candidate_id (INTEGER),
Candidate_Assessments.qualification (CHAR(15)),
Candidate_Assessments.assessment_date (DATETIME),
Candidate_Assessments.asessment_outcome_code (CHAR(15)),
)
TABLE Candidates (
Candidates.candidate_id (INTEGER),
Candidates.candidate_details (VARCHAR(255)),
)
TABLE Courses (
Courses.course_id (VARCHAR(100)),
Courses.course_name (VARCHAR(120)),
Courses.course_description (VARCHAR(255)),
Courses.other_details (VARCHAR(255)),
)
TABLE People (
People.person_id (INTEGER),
People.first_name (VARCHAR(255)),
People.middle_name (VARCHAR(255)),
People.last_name (VARCHAR(255)),
People.cell_mobile_number (VARCHAR(40)),
People.email_address (VARCHAR(40)),
People.login_name (VARCHAR(40)),
People.password (VARCHAR(40)),
)
TABLE People_Addresses (
People_Addresses.person_address_id (INTEGER),
People_Addresses.person_id (INTEGER),
People_Addresses.address_id (INTEGER),
People_Addresses.date_from (DATETIME),
People_Addresses.date_to (DATETIME),
)
TABLE Student_Course_Attendance (
Student_Course_Attendance.student_id (INTEGER),
Student_Course_Attendance.course_id (INTEGER),
Student_Course_Attendance.date_of_attendance (DATETIME),
)
TABLE Student_Course_Registrations (
Student_Course_Registrations.student_id (INTEGER),
Student_Course_Registrations.course_id (INTEGER),
Student_Course_Registrations.registration_date (DATETIME),
)
TABLE Students (
Students.student_id (INTEGER),
Students.student_details (VARCHAR(255)),
)
Possible JOINs:
Candidate_Assessments.candidate_id = Candidates.candidate_id
Candidates.candidate_id = People.person_id
People_Addresses.person_id = People.person_id
People_Addresses.address_id = Addresses.address_id
Student_Course_Attendance.student_id = Student_Course_Registrations.student_id
Student_Course_Attendance.course_id = Student_Course_Registrations.course_id
Student_Course_Registrations.student_id = Students.student_id
Student_Course_Registrations.course_id = Courses.course_id
Students.student_id = People.person_id
| TABLE addresses (
addresses.address_id (INTEGER),
addresses.line_1 (VARCHAR(80)),
addresses.line_2 (VARCHAR(80)),
addresses.city (VARCHAR(50)),
addresses.zip_postcode (CHAR(20)),
addresses.state_province_county (VARCHAR(50)),
addresses.country (VARCHAR(50)),
)
TABLE candidate_assessments (
candidate_assessments.candidate_id (INTEGER),
candidate_assessments.qualification (CHAR(15)),
candidate_assessments.assessment_date (DATETIME),
candidate_assessments.asessment_outcome_code (CHAR(15)),
)
TABLE candidates (
candidates.candidate_id (INTEGER),
candidates.candidate_details (VARCHAR(255)),
)
TABLE courses (
courses.course_id (VARCHAR(100)),
courses.course_name (VARCHAR(120)),
courses.course_description (VARCHAR(255)),
courses.other_details (VARCHAR(255)),
)
TABLE people (
people.person_id (INTEGER),
people.first_name (VARCHAR(255)),
people.middle_name (VARCHAR(255)),
people.last_name (VARCHAR(255)),
people.cell_mobile_number (VARCHAR(40)),
people.email_address (VARCHAR(40)),
people.login_name (VARCHAR(40)),
people.password (VARCHAR(40)),
)
TABLE people_addresses (
people_addresses.person_address_id (INTEGER),
people_addresses.person_id (INTEGER),
people_addresses.address_id (INTEGER),
people_addresses.date_from (DATETIME),
people_addresses.date_to (DATETIME),
)
TABLE student_course_attendance (
student_course_attendance.student_id (INTEGER),
student_course_attendance.course_id (INTEGER),
student_course_attendance.date_of_attendance (DATETIME),
)
TABLE student_course_registrations (
student_course_registrations.student_id (INTEGER),
student_course_registrations.course_id (INTEGER),
student_course_registrations.registration_date (DATETIME),
)
TABLE students (
students.student_id (INTEGER),
students.student_details (VARCHAR(255)),
)
Possible JOINs:
candidate_assessments.candidate_id = candidates.candidate_id
candidates.candidate_id = people.person_id
people_addresses.person_id = people.person_id
people_addresses.address_id = addresses.address_id
student_course_attendance.student_id = student_course_registrations.student_id
student_course_attendance.course_id = student_course_registrations.course_id
student_course_registrations.student_id = students.student_id
student_course_registrations.course_id = courses.course_id
students.student_id = people.person_id
|