db_id stringclasses 146
values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146
values |
|---|---|---|---|
formula_1 | What are the first names of all the different drivers in alphabetical order? | SELECT DISTINCT forename FROM drivers ORDER BY forename ASC | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | List the names of all distinct races in reversed lexicographic order? | SELECT DISTINCT name FROM races ORDER BY name DESC | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the different names of all the races in reverse alphabetical order? | SELECT DISTINCT name FROM races ORDER BY name DESC | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of races held between 2009 and 2011? | SELECT name FROM races WHERE YEAR BETWEEN 2009 AND 2011 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of all races held between 2009 and 2011? | SELECT name FROM races WHERE YEAR BETWEEN 2009 AND 2011 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of races held after 12:00:00 or before 09:00:00? | SELECT name FROM races WHERE TIME > "12:00:00" OR TIME < "09:00:00" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of all races that occurred after 12:00:00 or before 09:00:00? | SELECT name FROM races WHERE TIME > "12:00:00" OR TIME < "09:00:00" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the drivers' first, last names and id who had more than 8 pit stops or participated in more than 5 race results? | SELECT T1.forename , T1.surname , T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 8 UNION SELECT T1.forename , T1.surname , T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 5 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the drivers' first names,last names, and ids for all those that had more than 8 stops or participated in more than 5 races? | SELECT T1.forename , T1.surname , T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 8 UNION SELECT T1.forename , T1.surname , T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 5 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the drivers' last names and id who had 11 pit stops and participated in more than 5 race results? | SELECT T1.surname , T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) = 11 INTERSECT SELECT T1.surname , T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 5 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the last names and ids of all drivers who had 11 pit stops and participated in more than 5 races? | SELECT T1.surname , T1.driverid FROM drivers AS T1 JOIN pitstops AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) = 11 INTERSECT SELECT T1.surname , T1.driverid FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid GROUP BY T1.driverid HAVING count(*) > 5 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the id and last name of the driver who participated in the most races after 2010? | SELECT T1.driverid , T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid WHERE T3.year > 2010 GROUP BY T1.driverid ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the id and last name of the driver who participated in the most races after 2010? | SELECT T1.driverid , T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid WHERE T3.year > 2010 GROUP BY T1.driverid ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of circuits that belong to UK or Malaysia? | SELECT name FROM circuits WHERE country = "UK" OR country = "Malaysia" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of all the circuits that are in the UK or Malaysia? | SELECT name FROM circuits WHERE country = "UK" OR country = "Malaysia" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | Find the id and location of circuits that belong to France or Belgium? | SELECT circuitid , LOCATION FROM circuits WHERE country = "France" OR country = "Belgium" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the ids and locations of all circuits in France or Belgium? | SELECT circuitid , LOCATION FROM circuits WHERE country = "France" OR country = "Belgium" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | Find the names of Japanese constructors that have once earned more than 5 points? | SELECT T1.name FROM constructors AS T1 JOIN constructorstandings AS T2 ON T1.constructorid = T2.constructorid WHERE T1.nationality = "Japanese" AND T2.points > 5 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the names of all the Japanese constructors that have earned more than 5 points? | SELECT T1.name FROM constructors AS T1 JOIN constructorstandings AS T2 ON T1.constructorid = T2.constructorid WHERE T1.nationality = "Japanese" AND T2.points > 5 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the average fastest lap speed in race named 'Monaco Grand Prix' in 2008 ? | SELECT avg(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the average fastest lap speed for the Monaco Grand Prix in 2008? | SELECT avg(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the maximum fastest lap speed in race named 'Monaco Grand Prix' in 2008 ? | SELECT max(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the maximum fastest lap speed in the Monaco Grand Prix in 2008? | SELECT max(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = "Monaco Grand Prix" | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the maximum fastest lap speed in races held after 2004 grouped by race name and ordered by year? | SELECT max(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | For each race name, What is the maximum fastest lap speed for races after 2004 ordered by year? | SELECT max(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the average fastest lap speed in races held after 2004 grouped by race name and ordered by year? | SELECT avg(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the average fastest lap speed for races held after 2004, for each race, ordered by year? | SELECT avg(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | Find the id, forename and number of races of all drivers who have at least participated in two races? | SELECT T1.driverid , T1.forename , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) >= 2 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What is the id, forename, and number of races for all drivers that have participated in at least 2 races? | SELECT T1.driverid , T1.forename , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) >= 2 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | Find the driver id and number of races of all drivers who have at most participated in 30 races? | SELECT T1.driverid , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) <= 30 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | For each id of a driver who participated in at most 30 races, how many races did they participate in? | SELECT T1.driverid , count(*) FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid HAVING count(*) <= 30 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | Find the id and surname of the driver who participated the most number of races? | SELECT T1.driverid , T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
formula_1 | What are the ids and last names of all drivers who participated in the most races? | SELECT T1.driverid , T1.surname FROM drivers AS T1 JOIN results AS T2 ON T1.driverid = T2.driverid JOIN races AS T3 ON T2.raceid = T3.raceid GROUP BY T1.driverid ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE "circuits" (
"circuitId" INTEGER PRIMARY KEY,
"circuitRef" TEXT,
"name" TEXT,
"location" TEXT,
"country" TEXT,
"lat" REAL,
"lng" REAL,
"alt" TEXT,
"url" TEXT
)
3 rows from circuits table:
circuitId circuitRef name location country lat lng alt url
1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.84970 144.9680 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit
2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.7380 http://en.wikipedia.org/wiki/Sepang_International_Circuit
3 bahrain Bahrain International Circuit Sakhir Bahrain 26.03250 50.5106 http://en.wikipedia.org/wiki/Bahrain_International_Circuit
CREATE TABLE "races" (
"raceId" INTEGER PRIMARY KEY,
"year" INTEGER,
"round" INTEGER,
"circuitId" INTEGER,
"name" TEXT,
"date" TEXT,
"time" TEXT,
"url" TEXT,
FOREIGN KEY ("circuitId") REFERENCES "circuits"("circuitId")
)
3 rows from races table:
raceId year round circuitId name date time url
1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix
2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix
3 2009 3 17 Chinese Grand Prix 2009-04-19 07:00:00 http://en.wikipedia.org/wiki/2009_Chinese_Grand_Prix
CREATE TABLE "drivers" (
"driverId" INTEGER PRIMARY KEY,
"driverRef" TEXT,
"number" TEXT,
"code" TEXT,
"forename" TEXT,
"surname" TEXT,
"dob" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from drivers table:
driverId driverRef number code forename surname dob nationality url
1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton
2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld
3 rosberg 6 ROS Nico Rosberg 27/06/1985 German http://en.wikipedia.org/wiki/Nico_Rosberg
CREATE TABLE "status" (
"statusId" INTEGER PRIMARY KEY,
"status" TEXT
)
3 rows from status table:
statusId status
1 Finished
2 Disqualified
3 Accident
CREATE TABLE "seasons" (
"year" INTEGER PRIMARY KEY,
"url" TEXT
)
3 rows from seasons table:
year url
1950 http://en.wikipedia.org/wiki/1950_Formula_One_season
1951 http://en.wikipedia.org/wiki/1951_Formula_One_season
1952 http://en.wikipedia.org/wiki/1952_Formula_One_season
CREATE TABLE "constructors" (
"constructorId" INTEGER PRIMARY KEY,
"constructorRef" TEXT,
"name" TEXT,
"nationality" TEXT,
"url" TEXT
)
3 rows from constructors table:
constructorId constructorRef name nationality url
1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren
2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber
3 williams Williams British http://en.wikipedia.org/wiki/Williams_Grand_Prix_Engineering
CREATE TABLE "constructorStandings" (
"constructorStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorStandings table:
constructorStandingsId raceId constructorId points position positionText wins
1 18 1 14.0 1 1 1
2 18 2 8.0 3 3 0
3 18 3 9.0 2 2 0
CREATE TABLE "results" (
"resultId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"grid" INTEGER,
"position" TEXT,
"positionText" TEXT,
"positionOrder" INTEGER,
"points" REAL,
"laps" TEXT,
"time" TEXT,
"milliseconds" TEXT,
"fastestLap" TEXT,
"rank" TEXT,
"fastestLapTime" TEXT,
"fastestLapSpeed" TEXT,
"statusId" INTEGER,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from results table:
resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId
1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1
2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1
3 18 3 3 7 7 3 3 3 6.0 58 8.163 5698779 41 5 01:28.1 216.719 1
CREATE TABLE "driverStandings" (
"driverStandingsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"points" REAL,
"position" INTEGER,
"positionText" TEXT,
"wins" INTEGER,
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from driverStandings table:
driverStandingsId raceId driverId points position positionText wins
1 18 1 10.0 1 1 1
2 18 2 8.0 2 2 0
3 18 3 6.0 3 3 0
CREATE TABLE "constructorResults" (
"constructorResultsId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"constructorId" INTEGER,
"points" REAL,
"status" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId")
)
3 rows from constructorResults table:
constructorResultsId raceId constructorId points status
1 18 1 14.0 NULL
2 18 2 8.0 NULL
3 18 3 9.0 NULL
CREATE TABLE "qualifying" (
"qualifyId" INTEGER PRIMARY KEY,
"raceId" INTEGER,
"driverId" INTEGER,
"constructorId" INTEGER,
"number" INTEGER,
"position" INTEGER,
"q1" TEXT,
"q2" TEXT,
"q3" TEXT,
FOREIGN KEY("constructorId") REFERENCES "constructors"("constructorId"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from qualifying table:
qualifyId raceId driverId constructorId number position q1 q2 q3
1 18 1 1 22 1 1:26.572 1:25.187 1:26.714
2 18 9 2 4 2 1:26.103 1:25.315 1:26.869
3 18 5 1 23 3 1:25.664 1:25.452 1:27.079
CREATE TABLE "pitStops" (
"raceId" INTEGER,
"driverId" INTEGER,
"stop" INTEGER,
"lap" INTEGER,
"time" TEXT,
"duration" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY ("raceId", "driverId", "stop"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from pitStops table:
Empty DataFrame
Columns: [raceId, driverId, stop, lap, time, duration, milliseconds]
Index: []
CREATE TABLE "lapTimes" (
"raceId" INTEGER,
"driverId" INTEGER,
"lap" INTEGER,
"position" INTEGER,
"time" TEXT,
"milliseconds" INTEGER,
PRIMARY KEY("raceId", "driverId", "lap"),
FOREIGN KEY("raceId") REFERENCES "races"("raceId"),
FOREIGN KEY ("driverId") REFERENCES "drivers"("driverId")
)
3 rows from lapTimes table:
Empty DataFrame
Columns: [raceId, driverId, lap, position, time, milliseconds]
Index: []
|
machine_repair | How many technicians are there? | SELECT count(*) FROM technician | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What is the number of technicians? | SELECT count(*) FROM technician | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | List the names of technicians in ascending order of age. | SELECT Name FROM technician ORDER BY Age ASC | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of the technicians by ascending order of age? | SELECT Name FROM technician ORDER BY Age ASC | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the team and starting year of technicians? | SELECT Team , Starting_Year FROM technician | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What is the team and starting year for each technician? | SELECT Team , Starting_Year FROM technician | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | List the name of technicians whose team is not "NYY". | SELECT Name FROM technician WHERE Team != "NYY" | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What is the name of the technician whose team is not 'NYY'? | SELECT Name FROM technician WHERE Team != "NYY" | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show the name of technicians aged either 36 or 37 | SELECT Name FROM technician WHERE Age = 36 OR Age = 37 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of the technicians aged either 36 or 37? | SELECT Name FROM technician WHERE Age = 36 OR Age = 37 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What is the starting year of the oldest technicians? | SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What is the starting year for the oldest technician? | SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show different teams of technicians and the number of technicians in each team. | SELECT Team , COUNT(*) FROM technician GROUP BY Team | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | For each team, how many technicians are there? | SELECT Team , COUNT(*) FROM technician GROUP BY Team | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Please show the team that has the most number of technicians. | SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the teams with the most technicians? | SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show the team that have at least two technicians. | SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What is the team with at least 2 technicians? | SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show names of technicians and series of machines they are assigned to repair. | SELECT T3.Name , T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of technicians and the machine series that they repair? | SELECT T3.Name , T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show names of technicians in ascending order of quality rank of the machine they are assigned. | SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of the technicians by ascending order of quality rank for the machine they are assigned? | SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show names of technicians who are assigned to repair machines with value point more than 70. | SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID WHERE T2.value_points > 70 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of the technicians that are assigned to repair machines with more point values than 70? | SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID WHERE T2.value_points > 70 | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show names of technicians and the number of machines they are assigned to repair. | SELECT T2.Name , COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID = T2.technician_ID GROUP BY T2.Name | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of the technicians and how many machines are they assigned to repair? | SELECT T2.Name , COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID = T2.technician_ID GROUP BY T2.Name | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | List the names of technicians who have not been assigned to repair machines. | SELECT Name FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment) | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the names of the technicians that have not been assigned to repair machines? | SELECT Name FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment) | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | Show the starting years shared by technicians from team "CLE" and "CWS". | SELECT Starting_Year FROM technician WHERE Team = "CLE" INTERSECT SELECT Starting_Year FROM technician WHERE Team = "CWS" | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
machine_repair | What are the starting years shared by the technicians from the team "CLE" or "CWS"? | SELECT Starting_Year FROM technician WHERE Team = "CLE" INTERSECT SELECT Starting_Year FROM technician WHERE Team = "CWS" | CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)
3 rows from repair table:
repair_ID name Launch_Date Notes
1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit
2 Discoverer 1 28 Feb 2009 First object in polar orbit
3 Discoverer 3 03 Jun 2009 repair failed. Failed to achieve orbit
CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)
3 rows from machine table:
Machine_ID Making_Year Class Team Machine_series value_points quality_rank
1 1991 125cc Hero Sports TS- Honda RS125 105.0 2
2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1
3 1993 125cc Marlboro Pileri - Honda RS125 129.0 4
CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)
3 rows from technician table:
technician_id Name Team Starting_Year Age
1.0 Joe Sewell NYY 2012.0 37
2.0 John Brown NYY 2013.0 36
3.0 Tony Sewell CLE 2005.0 43
CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)
3 rows from repair_assignment table:
technician_id repair_ID Machine_ID
1 1 1
2 2 2
3 3 3
|
entrepreneur | How many entrepreneurs are there? | SELECT count(*) FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Count the number of entrepreneurs. | SELECT count(*) FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | List the companies of entrepreneurs in descending order of money requested. | SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the companies of entrepreneurs, ordered descending by amount of money requested? | SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | List the companies and the investors of entrepreneurs. | SELECT Company , Investor FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the companies and investors that correspond to each entrepreneur? | SELECT Company , Investor FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What is the average money requested by all entrepreneurs? | SELECT avg(Money_Requested) FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the average money requested across all entrepreneurs. | SELECT avg(Money_Requested) FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the names of people in ascending order of weight? | SELECT Name FROM People ORDER BY Weight ASC | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the names of people, ordered by weight ascending. | SELECT Name FROM People ORDER BY Weight ASC | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the names of entrepreneurs? | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the names of entrepreneurs. | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the names of entrepreneurs whose investor is not "Rachel Elnaugh"? | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor != "Rachel Elnaugh" | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the names of entrepreneurs do no not have the investor Rachel Elnaugh. | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor != "Rachel Elnaugh" | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What is the weight of the shortest person? | SELECT Weight FROM people ORDER BY Height ASC LIMIT 1 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the weight of the shortest person. | SELECT Weight FROM people ORDER BY Height ASC LIMIT 1 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What is the name of the entrepreneur with the greatest weight? | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the name of the heaviest entrepreneur. | SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What is the total money requested by entrepreneurs with height more than 1.85? | SELECT sum(T1.Money_Requested) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Give the total money requested by entrepreneurs who are taller than 1.85. | SELECT sum(T1.Money_Requested) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 1.85 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the dates of birth of entrepreneurs with investor "Simon Woodroffe" or "Peter Jones"? | SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones" | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the dates of birth for entrepreneurs who have either the investor Simon Woodroffe or Peter Jones. | SELECT T2.Date_of_Birth FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones" | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the weights of entrepreneurs in descending order of money requested? | SELECT T2.Weight FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested DESC | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the weights of entrepreneurs, ordered descending by amount of money requested. | SELECT T2.Weight FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested DESC | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the investors of entrepreneurs and the corresponding number of entrepreneurs invested by each investor? | SELECT Investor , COUNT(*) FROM entrepreneur GROUP BY Investor | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | How many entrepreneurs correspond to each investor? | SELECT Investor , COUNT(*) FROM entrepreneur GROUP BY Investor | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What is the investor that has invested in the most number of entrepreneurs? | SELECT Investor FROM entrepreneur GROUP BY Investor ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the investor who have invested in the greatest number of entrepreneurs. | SELECT Investor FROM entrepreneur GROUP BY Investor ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the investors that have invested in at least two entrepreneurs? | SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Return the investors who have invested in two or more entrepreneurs. | SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | List the names of entrepreneurs and their companies in descending order of money requested? | SELECT T2.Name , T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the names of entrepreneurs and their corresponding investors, ordered descending by the amount of money requested? | SELECT T2.Name , T1.Company FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Money_Requested | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | List the names of people that are not entrepreneurs. | SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM entrepreneur) | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the names of people who are not entrepreneurs? | SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM entrepreneur) | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | Show the investors shared by entrepreneurs that requested more than 140000 and entrepreneurs that requested less than 120000. | SELECT Investor FROM entrepreneur WHERE Money_Requested > 140000 INTERSECT SELECT Investor FROM entrepreneur WHERE Money_Requested < 120000 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | What are the investors who have invested in both entrepreneurs who requested more than 140000 and entrepreneurs who requested less than 120000? | SELECT Investor FROM entrepreneur WHERE Money_Requested > 140000 INTERSECT SELECT Investor FROM entrepreneur WHERE Money_Requested < 120000 | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
entrepreneur | How many distinct companies are there? | SELECT count(DISTINCT Company) FROM entrepreneur | CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)
3 rows from entrepreneur table:
Entrepreneur_ID People_ID Company Money_Requested Investor
1 1 Umbrolly 150000.0 Duncan Bannatyne
2 2 Grails Ltd 120000.0 Doug Richard
3 3 Le Beanock 54000.0 Rachel Elnaugh
CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Name Height Weight Date_of_Birth
1 Francesco Postiglione 1.90 80.0 1972-04-29
2 Leonardo Binchi 1.86 57.0 1975-08-27
3 Fabrizio Buonocore 1.83 45.0 1977-04-28
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.