create view ItemFlightDetails (FlightId, FlightNumber, Origin, Destination, ItemId, Name,
    Description, Price, Brand, Sold, Revenue) as
    select flight.id, flight.flightnumber, departureAirport.code,
           arrivalAirport.code, item.id,item.name, item.description, item.price,
           item.brand, itemssold.quantity, itemssold.quantity * item.price
    from flight
    join itemssold on flight.id = itemssold.flightid
    join item on itemssold.itemid = item.id
    join gate as departureGate on departureGate.id = flight.actualgatedepartureid
    join gate as arrivalGate on arrivalGate.id = flight.actualgatearrivalid
    join terminal as departureTerminal on departureTerminal.id = departureGate.terminalid
    join terminal as arrivalTerminal on arrivalTerminal.id = arrivalGate.terminalid
    join airport as departureAirport on departureAirport.id = departureTerminal.airportid
    join airport as arrivalAirport on arrivalAirport.id = arrivalTerminal.airportid;

