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 ("Denver", "DEN", "Denver International Airport");
INSERT INTO "airports" VALUES ("San Francisco", "SFO", "San Francisco International Airport");
INSERT INTO "airports" VALUES ("Seattle", "SEA", "Seattle-Tacoma International Airport");
INSERT INTO "airports" VALUES ("Miami", "MIA", "Miami International Airport");
INSERT INTO "airports" VALUES ("London", "LHR", "Heathrow Airport");
INSERT INTO "airports" VALUES ("Paris", "CDG", "Charles de Gaulle Airport");
INSERT INTO "airports" VALUES ("Tokyo", "NRT", "Narita International Airport");
INSERT INTO "flights" VALUES ("1", "101", "JFK", "LAX");
INSERT INTO "flights" VALUES ("1", "102", "LAX", "JFK");
INSERT INTO "flights" VALUES ("2", "201", "ORD", "DFW");
INSERT INTO "flights" VALUES ("2", "202", "DFW", "ORD");
INSERT INTO "flights" VALUES ("3", "301", "ATL", "JFK");
INSERT INTO "flights" VALUES ("3", "302", "JFK", "ATL");
INSERT INTO "flights" VALUES ("4", "401", "DEN", "LAX");
INSERT INTO "flights" VALUES ("4", "402", "LAX", "DEN");
INSERT INTO "flights" VALUES ("5", "501", "SFO", "ORD");
INSERT INTO "flights" VALUES ("5", "502", "ORD", "SFO");
INSERT INTO "flights" VALUES ("1", "103", "JFK", "LAX");
INSERT INTO "flights" VALUES ("2", "203", "ORD", "LAX");
INSERT INTO "flights" VALUES ("3", "303", "ATL", "LAX");
INSERT INTO "flights" VALUES ("4", "403", "DEN", "JFK");
INSERT INTO "flights" VALUES ("5", "503", "SFO", "JFK");
INSERT INTO "flights" VALUES ("1", "104", "LAX", "JFK");
INSERT INTO "flights" VALUES ("2", "204", "DFW", "LAX");
INSERT INTO "flights" VALUES ("3", "304", "ATL", "ORD");
INSERT INTO "flights" VALUES ("4", "404", "DEN", "ORD");
INSERT INTO "flights" VALUES ("5", "504", "SFO", "ATL");
INSERT INTO "flights" VALUES ("6", "601", "MIA", "JFK");
INSERT INTO "flights" VALUES ("6", "602", "JFK", "MIA");
INSERT INTO "flights" VALUES ("7", "701", "SEA", "LAX");
INSERT INTO "flights" VALUES ("7", "702", "LAX", "SEA");
INSERT INTO "flights" VALUES ("8", "801", "LHR", "JFK");
INSERT INTO "flights" VALUES ("8", "802", "JFK", "LHR");
INSERT INTO "flights" VALUES ("9", "901", "CDG", "LAX");
INSERT INTO "flights" VALUES ("9", "902", "LAX", "CDG");
INSERT INTO "flights" VALUES ("10", "1001", "NRT", "SFO");
INSERT INTO "flights" VALUES ("10", "1002", "SFO", "NRT");
INSERT INTO "flights" VALUES ("1", "105", "JFK", "LAX");
INSERT INTO "flights" VALUES ("2", "205", "ORD", "LAX");
INSERT INTO "flights" VALUES ("3", "305", "ATL", "LAX");
INSERT INTO "flights" VALUES ("4", "405", "DEN", "LAX");
INSERT INTO "flights" VALUES ("5", "505", "SFO", "LAX");
INSERT INTO "flights" VALUES ("6", "603", "MIA", "LAX");
INSERT INTO "flights" VALUES ("7", "703", "SEA", "LAX");
INSERT INTO "flights" VALUES ("8", "803", "LHR", "LAX");
INSERT INTO "flights" VALUES ("9", "903", "CDG", "LAX");
INSERT INTO "flights" VALUES ("10", "1003", "NRT", "LAX");