CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB)
CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER)
CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB)
CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER)
CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER)
CREATE TABLE month (month_number NUMBER, month_name CLOB)
CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER)
CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB)
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2)
CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB)
CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER)
CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB)
CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER)
CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2)
CREATE TABLE code_description (code VARCHAR2, description CLOB)
CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER)
CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2)
CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2)
CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2)
CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER)
CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2)
CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2)
CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2)
CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB)
CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2)

what FIRST class airplane goes from PHILADELPHIA to SAN FRANCISCO and stops in DALLAS in the afternoon on monday
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, airport_service AS AIRPORT_SERVICE_4, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, city AS CITY_4, date_day, days, equipment_sequence, fare, fare_basis, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_fare, flight_leg, flight_stop WHERE (((date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND FLIGHT_0.flight_days = days.days_code AND FLIGHT_0.flight_id = flight_fare.flight_id) AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DALLAS' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND FLIGHT_0.flight_id = flight_stop.flight_id) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND FLIGHT_0.to_airport = AIRPORT_SERVICE_1.airport_code) AND ((FLIGHT_1.arrival_time <= 1800 AND FLIGHT_1.arrival_time >= 1200) AND CITY_4.city_code = AIRPORT_SERVICE_4.city_code AND CITY_4.city_name = 'DALLAS' AND FLIGHT_1.to_airport = AIRPORT_SERVICE_4.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_3.city_code = AIRPORT_SERVICE_3.city_code AND CITY_3.city_name = 'PHILADELPHIA' AND equipment_sequence.aircraft_code = aircraft.aircraft_code AND FLIGHT_0.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND FLIGHT_0.flight_id = flight_leg.flight_id AND FLIGHT_0.from_airport = AIRPORT_SERVICE_0.airport_code AND FLIGHT_1.flight_id = flight_leg.leg_flight AND FLIGHT_1.from_airport = AIRPORT_SERVICE_3.airport_code
SELECT DISTINCT "aircraft"."aircraft_code" FROM "aircraft" CROSS JOIN "airport_service" "AIRPORT_SERVICE_4" JOIN "date_day" ON "date_day"."day_number" = 21 AND "date_day"."month_number" = 2 AND "date_day"."year" = 1991 JOIN "city" "CITY_4" ON "AIRPORT_SERVICE_4"."city_code" = "CITY_4"."city_code" AND "CITY_4"."city_name" = 'DALLAS' JOIN "flight" "FLIGHT_1" ON "AIRPORT_SERVICE_4"."airport_code" = "FLIGHT_1"."to_airport" AND "FLIGHT_1"."arrival_time" <= 1800 AND "FLIGHT_1"."arrival_time" >= 1200 JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "equipment_sequence" ON "aircraft"."aircraft_code" = "equipment_sequence"."aircraft_code" JOIN "airport_service" "AIRPORT_SERVICE_3" ON "AIRPORT_SERVICE_3"."airport_code" = "FLIGHT_1"."from_airport" JOIN "flight" "FLIGHT_0" ON "FLIGHT_0"."aircraft_code_sequence" = "equipment_sequence"."aircraft_code_sequence" AND "FLIGHT_0"."flight_days" = "days"."days_code" JOIN "airport_service" "AIRPORT_SERVICE_0" ON "AIRPORT_SERVICE_0"."airport_code" = "FLIGHT_0"."from_airport" JOIN "airport_service" "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "FLIGHT_0"."to_airport" JOIN "city" "CITY_3" ON "AIRPORT_SERVICE_3"."city_code" = "CITY_3"."city_code" AND "CITY_3"."city_name" = 'PHILADELPHIA' JOIN "flight_fare" ON "FLIGHT_0"."flight_id" = "flight_fare"."flight_id" JOIN "flight_leg" ON "FLIGHT_0"."flight_id" = "flight_leg"."flight_id" AND "FLIGHT_1"."flight_id" = "flight_leg"."leg_flight" JOIN "flight_stop" ON "FLIGHT_0"."flight_id" = "flight_stop"."flight_id" JOIN "airport_service" "AIRPORT_SERVICE_2" ON "AIRPORT_SERVICE_2"."airport_code" = "flight_stop"."stop_airport" JOIN "city" "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHILADELPHIA' JOIN "city" "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" JOIN "city" "CITY_2" ON "AIRPORT_SERVICE_2"."city_code" = "CITY_2"."city_code" AND "CITY_2"."city_name" = 'DALLAS' JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."class_type" = 'FIRST'