Dataset Viewer
Auto-converted to Parquet Duplicate
db_id
stringclasses
112 values
query
stringlengths
20
523
question
stringlengths
19
224
task_id
int64
0
7k
schema
stringclasses
112 values
complete_schema
stringclasses
112 values
department_management
SELECT count(*) FROM head WHERE age > 56
How many heads of the departments are older than 56 ?
0
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT name , born_state , age FROM head ORDER BY age
List the name, born state and age of the heads of departments ordered by age.
1
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT creation , name , budget_in_billions FROM department
List the creation year, name and budget of each department.
2
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT max(budget_in_billions) , min(budget_in_billions) FROM department
What are the maximum and minimum budget of the departments?
3
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15
What is the average number of employees of the departments whose rank is between 10 and 15?
4
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT name FROM head WHERE born_state != 'California'
What are the names of the heads who are born outside the California state?
5
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama'
What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?
6
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3
What are the names of the states where at least 3 heads were born?
7
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1
In which year were most departments established?
8
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT T1.name , T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?
9
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT count(DISTINCT temporary_acting) FROM management
How many acting statuses are there?
10
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management);
How many departments are led by heads who are not mentioned?
11
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'
What are the distinct ages of the heads who are acting?
12
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.he...
List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born.
13
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT T1.department_id , T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1
Which department has more than 1 head at a time? List the id, name and the number of heads.
14
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
department_management
SELECT head_id , name FROM head WHERE name LIKE '%Ha%'
Which head's name has the substring 'Ha'? List the id and name.
15
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); CREATE TABLE IF NOT EXISTS "head" ( "head_ID" int, "name" text, "born_state" text, "age...
PRAGMA foreign_keys=ON; BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "department" ( "Department_ID" int, "Name" text, "Creation" text, "Ranking" int, "Budget_in_Billions" real, "Num_Employees" real, PRIMARY KEY ("Department_ID") ); INSERT INTO department VALUES(1,'State','1789','1',9.9600000000000008526,30265.99999999...
farm
SELECT count(*) FROM farm
How many farms are there?
16
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT count(*) FROM farm
Count the number of farms.
17
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC
List the total number of horses on farms in ascending order.
18
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Total_Horses FROM farm ORDER BY Total_Horses ASC
What is the total horses record for each farm, sorted ascending?
19
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens'
What are the hosts of competitions whose theme is not "Aliens"?
20
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens'
Return the hosts of competitions for which the theme is not Aliens?
21
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Theme FROM farm_competition ORDER BY YEAR ASC
What are the themes of farm competitions sorted by year in ascending order?
22
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Theme FROM farm_competition ORDER BY YEAR ASC
Return the themes of farm competitions, sorted by year ascending.
23
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000
What is the average number of working horses of farms with more than 5000 total number of horses?
24
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT avg(Working_Horses) FROM farm WHERE Total_Horses > 5000
Give the average number of working horses on farms with more than 5000 total horses.
25
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT max(Cows) , min(Cows) FROM farm
What are the maximum and minimum number of cows across all farms.
26
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT max(Cows) , min(Cows) FROM farm
Return the maximum and minimum number of cows across all farms.
27
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT count(DISTINCT Status) FROM city
How many different statuses do cities have?
28
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT count(DISTINCT Status) FROM city
Count the number of different statuses.
29
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Official_Name FROM city ORDER BY Population DESC
List official names of cities in descending order of population.
30
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Official_Name FROM city ORDER BY Population DESC
What are the official names of cities, ordered descending by population?
31
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1
List the official name and status of the city with the largest population.
32
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1
What is the official name and status of the city with the most residents?
33
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID
Show the years and the official names of the host cities of competitions.
34
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID
Give the years and official names of the cities of each competition.
35
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1
Show the official names of the cities that have hosted more than one competition.
36
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID HAVING COUNT(*) > 1
What are the official names of cities that have hosted more than one competition?
37
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1
Show the status of the city that has hosted the greatest number of competitions.
38
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T1.Status FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID GROUP BY T2.Host_city_ID ORDER BY COUNT(*) DESC LIMIT 1
What is the status of the city that has hosted the most competitions?
39
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
farm
SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000
Please show the themes of competitions with host cities having populations larger than 1000.
40
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
PRAGMA foreign_keys = ON; CREATE TABLE "city" ( "City_ID" int, "Official_Name" text, "Status" text, "Area_km_2" real, "Population" real, "Census_Ranking" text, PRIMARY KEY ("City_ID") ); CREATE TABLE "farm" ( "Farm_ID" int, "Year" int, "Total_Horses" real, "Working_Horses" real, "Total_Cattle" real, "Oxen" real, "Bul...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
134