PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "airports" (
"City" TEXT,
"AirportCode" TEXT UNIQUE,
"AirportName" TEXT,
PRIMARY KEY ("AirportCode")
);

CREATE TABLE "flights" (
"Airline" INT,
"FlightNo" INT,
"SourceAirport" TEXT,
"DestAirport" TEXT,
PRIMARY KEY ("Airline", "FlightNo"),
FOREIGN KEY ("SourceAirport") REFERENCES "airports"("AirportCode"),
FOREIGN KEY ("DestAirport") REFERENCES "airports"("AirportCode")
);





INSERT INTO "airports" VALUES ("New York", "JFK", "John F. Kennedy International Airport");
INSERT INTO "airports" VALUES ("Los Angeles", "LAX", "Los Angeles International Airport");
INSERT INTO "airports" VALUES ("Chicago", "ORD", "OHare International Airport");
INSERT INTO "airports" VALUES ("Dallas", "DFW", "Dallas/Fort Worth International Airport");
INSERT INTO "airports" VALUES ("Atlanta", "ATL", "Hartsfield-Jackson Atlanta International Airport");
INSERT INTO "airports" VALUES ("San Francisco", "SFO", "San Francisco International Airport");
INSERT INTO "airports" VALUES ("Denver", "DEN", "Denver International Airport");
INSERT INTO "airports" VALUES ("Miami", "MIA", "Miami International Airport");
INSERT INTO "airports" VALUES ("Seattle", "SEA", "Seattle-Tacoma International Airport");
INSERT INTO "airports" VALUES ("Houston", "IAH", "George Bush Intercontinental Airport");
INSERT INTO "flights" VALUES ("101", "1001", "JFK", "LAX");
INSERT INTO "flights" VALUES ("101", "1002", "JFK", "ORD");
INSERT INTO "flights" VALUES ("102", "2001", "LAX", "JFK");
INSERT INTO "flights" VALUES ("103", "3001", "ORD", "DFW");
INSERT INTO "flights" VALUES ("104", "4001", "DFW", "ATL");
INSERT INTO "flights" VALUES ("105", "5001", "ATL", "JFK");
INSERT INTO "flights" VALUES ("101", "1003", "JFK", "SFO");
INSERT INTO "flights" VALUES ("102", "2002", "LAX", "DEN");
INSERT INTO "flights" VALUES ("103", "3002", "ORD", "MIA");
INSERT INTO "flights" VALUES ("104", "4002", "DFW", "SEA");
INSERT INTO "flights" VALUES ("105", "5002", "ATL", "IAH");
INSERT INTO "flights" VALUES ("101", "1004", "JFK", "DEN");
INSERT INTO "flights" VALUES ("101", "1005", "JFK", "MIA");
INSERT INTO "flights" VALUES ("101", "1006", "JFK", "SEA");
INSERT INTO "flights" VALUES ("102", "2003", "LAX", "ORD");
INSERT INTO "flights" VALUES ("103", "3003", "ORD", "ATL");
INSERT INTO "flights" VALUES ("104", "4003", "DFW", "JFK");
INSERT INTO "flights" VALUES ("105", "5003", "ATL", "LAX");
INSERT INTO "flights" VALUES ("106", "6001", "SFO", "JFK");
INSERT INTO "flights" VALUES ("107", "7001", "DEN", "LAX");
INSERT INTO "flights" VALUES ("108", "8001", "MIA", "ORD");
INSERT INTO "flights" VALUES ("109", "9001", "SEA", "DFW");
INSERT INTO "flights" VALUES ("110", "10001", "IAH", "ATL");
INSERT INTO "flights" VALUES ("101", "1007", "JFK", "IAH");
INSERT INTO "flights" VALUES ("102", "2004", "LAX", "SFO");
INSERT INTO "flights" VALUES ("103", "3004", "ORD", "DEN");
INSERT INTO "flights" VALUES ("104", "4004", "DFW", "MIA");
INSERT INTO "flights" VALUES ("105", "5004", "ATL", "SEA");
INSERT INTO "flights" VALUES ("106", "6002", "SFO", "ORD");
INSERT INTO "flights" VALUES ("107", "7002", "DEN", "DFW");
INSERT INTO "flights" VALUES ("108", "8002", "MIA", "ATL");
INSERT INTO "flights" VALUES ("109", "9002", "SEA", "IAH");
INSERT INTO "flights" VALUES ("110", "10002", "IAH", "JFK");
INSERT INTO "flights" VALUES ("101", "1008", "JFK", "LAX");
INSERT INTO "flights" VALUES ("101", "1009", "JFK", "ORD");
INSERT INTO "flights" VALUES ("101", "1010", "JFK", "DFW");
INSERT INTO "flights" VALUES ("101", "1011", "JFK", "ATL");