{"airlines": {"columns": [[0, "uid", "INTEGER", 0, null, 1], [1, "Airline", "TEXT", 0, null, 0], [2, "Abbreviation", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0]], "primary_keys": ["uid"], "foreign_keys": [], "unique_constraints": [], "check_constraints": []}, "airports": {"columns": [[0, "City", "TEXT", 0, null, 0], [1, "AirportCode", "TEXT", 0, null, 1], [2, "AirportName", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0], [4, "CountryAbbrev", "TEXT", 0, null, 0]], "primary_keys": ["AirportCode"], "foreign_keys": [], "unique_constraints": [[[0, 1, "AirportCode"]]], "check_constraints": []}, "flights": {"columns": [[0, "Airline", "INTEGER", 0, null, 1], [1, "FlightNo", "INTEGER", 0, null, 2], [2, "SourceAirport", "TEXT", 0, null, 0], [3, "DestAirport", "TEXT", 0, null, 0]], "primary_keys": ["Airline", "FlightNo"], "foreign_keys": [[0, 0, "airports", "DestAirport", "AirportCode", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "airports", "SourceAirport", "AirportCode", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Airline"], [1, 1, "FlightNo"]]], "check_constraints": []}}
CREATE TABLE airlines (
    uid INTEGER   PRIMARY KEY,
    Airline TEXT,
    Abbreviation TEXT,
    Country TEXT
);

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

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