Datasets:

Modalities:
Text
Formats:
parquet
Libraries:
Datasets
pandas
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
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
40
Edit dataset card