db_id stringclasses 146
values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146
values |
|---|---|---|---|
aircraft | What are the descriptions for the aircrafts? | SELECT Description FROM aircraft | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the average number of international passengers of all airports? | SELECT avg(International_Passengers) FROM airport | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the average number of international passengers for an airport? | SELECT avg(International_Passengers) FROM airport | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the number of international and domestic passengers of the airport named London "Heathrow"? | SELECT International_Passengers , Domestic_Passengers FROM airport WHERE Airport_Name = "London Heathrow" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | How many international and domestic passengers are there in the airport London Heathrow? | SELECT International_Passengers , Domestic_Passengers FROM airport WHERE Airport_Name = "London Heathrow" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the total number of Domestic Passengers of airports that contain the word "London". | SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the total number of domestic passengers at all London airports? | SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the maximum and minimum number of transit passengers of all aiports. | SELECT max(Transit_Passengers) , min(Transit_Passengers) FROM airport | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the maximum and mininum number of transit passengers for all airports? | SELECT max(Transit_Passengers) , min(Transit_Passengers) FROM airport | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the name of pilots aged 25 or older? | SELECT Name FROM pilot WHERE Age >= 25 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | what is the name of every pilot who is at least 25 years old? | SELECT Name FROM pilot WHERE Age >= 25 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List all pilot names in ascending alphabetical order. | SELECT Name FROM pilot ORDER BY Name ASC | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of the pilots in alphabetical order? | SELECT Name FROM pilot ORDER BY Name ASC | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List names of all pilot aged 30 or younger in descending alphabetical order. | SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of all pilots 30 years old or young in descending alphabetical order? | SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | Please show the names of aircrafts associated with airport with name "London Gatwick". | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of all the aircrafts associated with London Gatwick airport? | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger than 10000000. | SELECT T1.Aircraft , T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Total_Passengers > 10000000 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names and descriptions of aircrafts associated with an airport that has more total passengers than 10000000? | SELECT T1.Aircraft , T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Total_Passengers > 10000000 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the average total number of passengers of airports that are associated with aircraft "Robinson R-22"? | SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = "Robinson R-22" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the average total number of passengers for all airports that the aircraft "Robinson R-22" visits? | SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = "Robinson R-22" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | Please list the location and the winning aircraft name. | SELECT T2.Location , T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the location and name of the winning aircraft? | SELECT T2.Location , T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List the name of the aircraft that has been named winning aircraft the most number of times. | SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the name of the aircraft that has won an award the most? | SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List the names of aircrafts and the number of times it won matches. | SELECT T1.Aircraft , COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | For each aircraft that has won an award, what is its name and how many time has it won? | SELECT T1.Aircraft , COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List names of all pilot in descending order of age. | SELECT Name FROM pilot ORDER BY Age DESC | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of all pilots listed by descending age? | SELECT Name FROM pilot ORDER BY Age DESC | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List the names of aircrafts and that won matches at least twice. | SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of all aircrafts that have won a match at least twice? | SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | List the names of aircrafts and that did not win any match. | SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH) | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of all aicrafts that have never won any match? | SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH) | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick" | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of all aircrafts that are associated with both London Heathrow and Gatwick airports? | SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | Show all information on the airport that has the largest number of international passengers. | SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is all the information on the airport with the largest number of international passengers? | SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30. | SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What is the name and age of the pilot younger than 30 who has won the most number of times? | SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | what is the name and age of the youngest winning pilot? | SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot ORDER BY t1.age LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | How old is the youngest winning pilot and what is their name? | SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot ORDER BY t1.age LIMIT 1 | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | find the name of pilots who did not win the matches held in the country of Australia. | SELECT name FROM pilot WHERE pilot_id NOT IN (SELECT Winning_Pilot FROM MATCH WHERE country = 'Australia') | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
aircraft | What are the names of the pilots that have not won any matches in Australia? | SELECT name FROM pilot WHERE pilot_id NOT IN (SELECT Winning_Pilot FROM MATCH WHERE country = 'Australia') | CREATE TABLE `pilot` (
`Pilot_Id` int(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Age` int(11) NOT NULL,
PRIMARY KEY (`Pilot_Id`)
)
3 rows from pilot table:
Pilot_Id Name Age
1 Prof. Zackery Collins 23
2 Katheryn Gorczany IV 20
3 Mr. Cristian Halvorson II 23
CREATE TABLE `aircraft` (
"Aircraft_ID" int(11) NOT NULL,
"Aircraft" varchar(50) NOT NULL,
"Description" varchar(50) NOT NULL,
"Max_Gross_Weight" varchar(50) NOT NULL,
"Total_disk_area" varchar(50) NOT NULL,
"Max_disk_Loading" varchar(50) NOT NULL,
PRIMARY KEY (`Aircraft_ID`)
)
3 rows from aircraft table:
Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading
1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²)
2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²)
3 CH-47D Chinook Tandem rotor helicopter 50,000 lb (22,680 kg) 5,655 ft² (526 m²) 8.8 lb/ft² (43 kg/m²)
CREATE TABLE `match` (
"Round" real,
"Location" text,
"Country" text,
"Date" text,
"Fastest_Qualifying" text,
"Winning_Pilot" text,
"Winning_Aircraft" text,
PRIMARY KEY ("Round"),
FOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),
FOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)
)
3 rows from match table:
Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft
1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1
2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1
3.0 Flamengo Beach , Rio de Janeiro Brazil May 8–9 Hannes Arch 6 2
CREATE TABLE `airport` (
"Airport_ID" int,
"Airport_Name" text,
"Total_Passengers" real,
"%_Change_2007" text,
"International_Passengers" real,
"Domestic_Passengers" real,
"Transit_Passengers" real,
"Aircraft_Movements" real,
"Freight_Metric_Tonnes" real,
PRIMARY KEY ("Airport_ID")
)
3 rows from airport table:
Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes
1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0
2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0
3 London Stansted 22360364.0 6.0% 19996947.0 2343428.0 19989.0 193282.0 197738.0
CREATE TABLE `airport_aircraft` (
"ID" int,
"Airport_ID" int,
"Aircraft_ID" int,
PRIMARY KEY ("Airport_ID","Aircraft_ID"),
FOREIGN KEY ("Airport_ID") REFERENCES `airport`(`Airport_ID`),
FOREIGN KEY ("Aircraft_ID") REFERENCES `aircraft`(`Aircraft_ID`)
)
3 rows from airport_aircraft table:
ID Airport_ID Aircraft_ID
1 6 5
2 2 1
3 1 2
|
local_govt_and_lot | How many residents does each property have? List property id and resident count. | SELECT T1.property_id , count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'? | SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id = T2.organization_id WHERE T2.organization_details = 'Denesik and Sons Party' | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | How many services has each resident requested? List the resident id, details, and the count in descending order of the count. | SELECT T1.resident_id , T1.other_details , count(*) FROM Residents AS T1 JOIN Residents_Services AS T2 ON T1.resident_id = T2.resident_id GROUP BY T1.resident_id ORDER BY count(*) DESC | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What is the maximum number that a certain service is provided? List the service id, details and number. | SELECT T1.service_id , T1.service_details , count(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id = T2.service_id GROUP BY T1.service_id ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | List the id and type of each thing, and the details of the organization that owns it. | SELECT T1.thing_id , T1.type_of_Thing_Code , T2.organization_details FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id = T2.organization_id | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What are the id and details of the customers who have at least 3 events? | SELECT T1.customer_id , T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 3 | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What is each customer's move in date, and the corresponding customer id and details? | SELECT T2.date_moved_in , T1.customer_id , T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | Which events have the number of notes between one and three? List the event id and the property id. | SELECT T1.Customer_Event_ID , T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID = T2.Customer_Event_ID GROUP BY T1.customer_event_id HAVING count(*) BETWEEN 1 AND 3 | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What are the distinct id and type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21' | SELECT DISTINCT T2.thing_id , T2.Type_of_Thing_Code FROM Timed_Status_of_Things AS T1 JOIN Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.Status_of_Thing_Code = 'Close' OR T1.Date_and_Date < '2017-06-19 02:59:21' | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | How many distinct locations have the things with service detail 'Unsatisfied' been located in? | SELECT count(DISTINCT T2.Location_Code) FROM Things AS T1 JOIN Timed_Locations_of_Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.service_details = 'Unsatisfied' | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | How many different status codes of things are there? | SELECT count(DISTINCT Status_of_Thing_Code) FROM Timed_Status_of_Things | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | Which organizations are not a parent organization of others? List the organization id. | SELECT organization_id FROM organizations EXCEPT SELECT parent_organization_id FROM organizations | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | When is the last day any resident moved in? | SELECT max(date_moved_in) FROM Residents | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What are the resident details containing the substring 'Miss'? | SELECT other_details FROM Residents WHERE other_details LIKE '%Miss%' | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | List the customer event id and the corresponding move in date and property id. | SELECT customer_event_id , date_moved_in , property_id FROM customer_events | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | How many customers did not have any event? | SELECT count(*) FROM customers WHERE customer_id NOT IN ( SELECT customer_id FROM customer_events ) | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
local_govt_and_lot | What are the distinct move in dates of the residents? | SELECT DISTINCT date_moved_in FROM residents | CREATE TABLE Customers (
customer_id INTEGER NOT NULL,
customer_details VARCHAR(255),
PRIMARY KEY (customer_id)
)
3 rows from Customers table:
customer_id customer_details
4 Mr. Raul Prosacco
5 Esteban Senger
16 Tyrique Durgan II
CREATE TABLE Properties (
property_id INTEGER NOT NULL,
property_type_code CHAR(15) NOT NULL,
property_address VARCHAR(255),
other_details VARCHAR(255),
PRIMARY KEY (property_id)
)
3 rows from Properties table:
property_id property_type_code property_address other_details
24 apartment 85456 Annie Lodge Suite 449 USA
107 house 2580 Yundt Plains USA
108 house 5983 Fleta Throughway USA
CREATE TABLE Residents (
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
date_moved_out DATETIME NOT NULL,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, property_id, date_moved_in),
FOREIGN KEY (property_id) REFERENCES Properties (property_id)
)
3 rows from Residents table:
resident_id property_id date_moved_in date_moved_out other_details
6 954 2017-06-17 15:43:33 2017-12-18 03:46:04 Anderson Batz
10 605 2015-03-27 12:00:00 2018-03-17 07:48:09 Miss Naomie Osinski
23 879 2015-03-27 12:00:00 2017-11-14 06:28:48 Jess Wyman
CREATE TABLE Organizations (
organization_id INTEGER NOT NULL,
parent_organization_id INTEGER,
organization_details VARCHAR(255),
PRIMARY KEY (organization_id)
)
3 rows from Organizations table:
organization_id parent_organization_id organization_details
7 7 Reinger, Hudson and Nolan Group
8 7 Denesik and Sons Party
10 8 Robel-Schulist Group
CREATE TABLE Services (
service_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (service_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Services table:
service_id organization_id service_type_code service_details
10 10 Cleanning Satisfied
11 7 Check Satisfied
13 8 Moving Out Satisfied
CREATE TABLE Residents_Services (
resident_id INTEGER NOT NULL,
service_id INTEGER NOT NULL,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255),
PRIMARY KEY (resident_id, service_id),
FOREIGN KEY (service_id) REFERENCES Services (service_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Residents_Services table:
resident_id service_id date_moved_in property_id date_requested date_provided other_details
6 49 2017-06-17 15:43:33 954 2016-07-25 01:32:23 2018-02-26 00:27:11 Satisfied
23 41 2015-03-27 12:00:00 879 2016-10-10 21:42:21 2017-08-21 06:23:06 Unsatisfied
28 11 2015-03-27 12:00:00 629 2017-07-14 19:03:47 2017-08-28 03:43:56 Unsatisfied
CREATE TABLE Things (
thing_id INTEGER NOT NULL,
organization_id INTEGER NOT NULL,
Type_of_Thing_Code CHAR(15) NOT NULL,
service_type_code CHAR(10) NOT NULL,
service_details VARCHAR(255),
PRIMARY KEY (thing_id),
FOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)
)
3 rows from Things table:
thing_id organization_id Type_of_Thing_Code service_type_code service_details
1 8 Electronics Check Unsatisfied
2 8 Electronics Cleanning Satisfied
10 8 Commen Check Satisfied
CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER NOT NULL,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER NOT NULL,
PRIMARY KEY (Customer_Event_ID),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id),
FOREIGN KEY (customer_id) REFERENCES Customers (customer_id),
FOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)
)
3 rows from Customer_Events table:
Customer_Event_ID customer_id date_moved_in property_id resident_id thing_id
70 19 2015-03-27 12:00:00 605 10 1
160 5 2015-03-27 12:00:00 879 23 80
166 16 2015-03-27 12:00:00 629 28 14
CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER NOT NULL,
Customer_Event_ID INTEGER NOT NULL,
service_type_code CHAR(15) NOT NULL,
resident_id INTEGER NOT NULL,
property_id INTEGER NOT NULL,
date_moved_in DATETIME NOT NULL,
PRIMARY KEY (Customer_Event_Note_ID),
FOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)
)
3 rows from Customer_Event_Notes table:
Customer_Event_Note_ID Customer_Event_ID service_type_code resident_id property_id date_moved_in
18 70 Cleanning 58 107 2016-08-04 01:06:05
21 428 Check 87 445 2016-12-11 01:05:14
32 70 Check 37 669 2016-07-10 04:09:56
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Date DATETIME NOT NULL,
Status_of_Thing_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id)
)
3 rows from Timed_Status_of_Things table:
thing_id Date_and_Date Status_of_Thing_Code
2 2016-05-27 23:33:34 Open
2 2016-07-17 08:35:27 Close
2 2017-06-19 02:59:21 In Progress
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER NOT NULL,
Date_and_Time DATETIME NOT NULL,
Location_Code CHAR(15) NOT NULL,
PRIMARY KEY (thing_id, Date_and_Time, Location_Code),
FOREIGN KEY (thing_id) REFERENCES Things (thing_id))
3 rows from Timed_Locations_of_Things table:
thing_id Date_and_Time Location_Code
2 2016-10-12 12:03:07 064 Charles Mou
10 2016-12-29 00:39:19 288 Lang Ferry
10 2017-10-21 04:21:54 854 Keeling Sho
|
school_player | How many schools are there? | SELECT count(*) FROM school | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Count the number of schools. | SELECT count(*) FROM school | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | List the locations of schools in ascending order of enrollment. | SELECT LOCATION FROM school ORDER BY Enrollment ASC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What is the list of school locations sorted in ascending order of school enrollment? | SELECT LOCATION FROM school ORDER BY Enrollment ASC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | List the locations of schools in descending order of founded year. | SELECT LOCATION FROM school ORDER BY Founded DESC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What is the list of school locations sorted in descending order of school foundation year? | SELECT LOCATION FROM school ORDER BY Founded DESC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the enrollments of schools whose denomination is not "Catholic"? | SELECT Enrollment FROM school WHERE Denomination != "Catholic" | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | List the enrollment for each school that does not have "Catholic" as denomination. | SELECT Enrollment FROM school WHERE Denomination != "Catholic" | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What is the average enrollment of schools? | SELECT avg(Enrollment) FROM school | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Take the average of the school enrollment. | SELECT avg(Enrollment) FROM school | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the teams of the players, sorted in ascending alphabetical order? | SELECT Team FROM player ORDER BY Team ASC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Find the team of each player and sort them in ascending alphabetical order. | SELECT Team FROM player ORDER BY Team ASC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | How many different positions of players are there? | SELECT count(DISTINCT POSITION) FROM player | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Count the number of distinct player positions. | SELECT count(DISTINCT POSITION) FROM player | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Find the team of the player of the highest age. | SELECT Team FROM player ORDER BY Age DESC LIMIT 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Which team has the oldest player? | SELECT Team FROM player ORDER BY Age DESC LIMIT 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | List the teams of the players with the top 5 largest ages. | SELECT Team FROM player ORDER BY Age DESC LIMIT 5 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the teams that have the 5 oldest players? | SELECT Team FROM player ORDER BY Age DESC LIMIT 5 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | For each player, show the team and the location of school they belong to. | SELECT T1.Team , T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the team and the location of school each player belongs to? | SELECT T1.Team , T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Show the locations of schools that have more than 1 player. | SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Which schools have more than 1 player? Give me the school locations. | SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Show the denomination of the school that has the most players. | SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What is the denomination of the school the most players belong to? | SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Show locations and nicknames of schools. | SELECT T1.Location , T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the location and nickname of each school? | SELECT T1.Location , T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Please show different denominations and the corresponding number of schools. | SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | For each denomination, return the denomination and the count of schools with that denomination. | SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Please show different denominations and the corresponding number of schools in descending order. | SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Order denominations in descending order of the count of schools with the denomination. Return each denomination with the count of schools. | SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | List the school color of the school that has the largest enrollment. | SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What is the school color of the school with the largest enrollment? | SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | List the locations of schools that do not have any player. | SELECT LOCATION FROM school WHERE School_ID NOT IN (SELECT School_ID FROM Player) | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Which schools do not have any player? Give me the school locations. | SELECT LOCATION FROM school WHERE School_ID NOT IN (SELECT School_ID FROM Player) | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Show the denomination shared by schools founded before 1890 and schools founded after 1900 | SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the denominations used by both schools founded before 1890 and schools founded after 1900? | SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Show the nicknames of schools that are not in division 1. | SELECT Nickname FROM school_details WHERE Division != "Division 1" | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the nicknames of schools whose division is not 1? | SELECT Nickname FROM school_details WHERE Division != "Division 1" | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | Show the denomination shared by more than one school. | SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
school_player | What are the denomination more than one school have? | SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1 | CREATE TABLE "school" (
"School_ID" int,
"School" text,
"Location" text,
"Enrollment" real,
"Founded" real,
"Denomination" text,
"Boys_or_Girls" text,
"Day_or_Boarding" text,
"Year_Entered_Competition" real,
"School_Colors" text,
PRIMARY KEY ("School_Id")
)
3 rows from school table:
School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors
1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold
2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue
3 Cranbrook School Bellevue Hill 1000.0 1918.0 Anglican Boys Day & Boarding 1929.0 Red, White & Blue
CREATE TABLE "school_details" (
"School_ID" int,
"Nickname" text,
"Colors" text,
"League" text,
"Class" text,
"Division" text,
PRIMARY KEY ("School_Id"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_details table:
School_ID Nickname Colors League Class Division
1 Tigers Blue and Yellow DSHA Flight A Division 1
2 Auks Dark Green and White DSHA Flight B Division 3
3 Buccaneers Garnet and White DSHA Fight A Division 1
CREATE TABLE "school_performance" (
"School_Id" int,
"School_Year" text,
"Class_A" text,
"Class_AA" text,
PRIMARY KEY ("School_Id","School_Year"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from school_performance table:
School_Id School_Year Class_A Class_AA
1 1987-88 Yantis Blanco
1 1988-89 Happy Blanco
1 1989-90 Skidmore-Tynan Bishop
CREATE TABLE "player" (
"Player_ID" int,
"Player" text,
"Team" text,
"Age" int,
"Position" text,
"School_ID" int,
PRIMARY KEY ("Player_ID"),
FOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)
)
3 rows from player table:
Player_ID Player Team Age Position School_ID
1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1
2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2
3 Eric Hosmer Kansas City Royals 16 First Baseman 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.