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 "airlines" (
"uid" INT,
"Airline" TEXT,
"Abbreviation" TEXT,
PRIMARY KEY ("uid")
);

CREATE TABLE "airports" (
"AirportCode" TEXT,
"Country" TEXT,
PRIMARY KEY ("AirportCode")
);

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





INSERT INTO "airlines" VALUES ("1", "Jetblue Airways", "JBL");
INSERT INTO "airlines" VALUES ("2", "Delta Airlines", "DAL");
INSERT INTO "airlines" VALUES ("3", "American Airlines", "AAL");
INSERT INTO "airlines" VALUES ("4", "Southwest Airlines", "SWA");
INSERT INTO "airlines" VALUES ("5", "United Airlines", "UAL");
INSERT INTO "airports" VALUES ("JFK", "USA");
INSERT INTO "airports" VALUES ("LGA", "USA");
INSERT INTO "airports" VALUES ("LAX", "USA");
INSERT INTO "airports" VALUES ("ORD", "USA");
INSERT INTO "airports" VALUES ("MIA", "USA");
INSERT INTO "airports" VALUES ("BOS", "USA");
INSERT INTO "airports" VALUES ("SFO", "USA");
INSERT INTO "airports" VALUES ("ATL", "USA");
INSERT INTO "airports" VALUES ("EWR", "USA");
INSERT INTO "airports" VALUES ("DCA", "USA");
INSERT INTO "flights" VALUES ("1", "100", "JFK");
INSERT INTO "flights" VALUES ("1", "101", "LGA");
INSERT INTO "flights" VALUES ("2", "200", "ATL");
INSERT INTO "flights" VALUES ("3", "300", "ORD");
INSERT INTO "flights" VALUES ("4", "400", "LAX");
INSERT INTO "flights" VALUES ("5", "500", "SFO");
INSERT INTO "flights" VALUES ("1", "102", "BOS");
INSERT INTO "flights" VALUES ("1", "103", "EWR");
INSERT INTO "flights" VALUES ("2", "201", "MIA");
INSERT INTO "flights" VALUES ("3", "301", "DCA");