1sf/bird-sql-train-with-schema huggingface dataset:
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: How many flights were there on 2018/8/1?
Evidence: on 2018/8/1 refers to FL_DATE = '2018/8/1';
SQL: SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Among the flights on 2018/8/1, how many of them departed from an airport in New York?
Evidence: on 2018/8/1 refers to FL_DATE = '2018/8/1'; departed from an airport in New York refers to ORIGIN = 'JFK';
SQL: SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND ORIGIN = 'JFK'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Please list the destination cities of all the flights that were cancelled on 2018/8/1.
Evidence: destination cities refers to DEST; cancelled refers to CANCELLED = 1; on 2018/8/1 refers to FL_DATE = '2018/8/1';
SQL: SELECT DEST FROM Airlines WHERE FL_DATE = '2018/8/1' AND CANCELLED = 1 GROUP BY DEST
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Please list the dates of the flights that were cancelled due to the most serious reason.
Evidence: dates of the flights refers to FL_DATE; cancelled refers to CANCELLED = 1; most serious reason refers to CANCELLATION_CODE = 'A';
SQL: SELECT FL_DATE FROM Airlines WHERE CANCELLATION_CODE = 'A' GROUP BY FL_DATE
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Please list the departure airports of the flights on 2018/8/1 that were delayed.
Evidence: departure airports refers ORIGIN; on 2018/8/1 refers to FL_DATE = '2018/8/1'; delayed refers to DEP_DELAY > 0;
SQL: SELECT T1.Description FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/1' AND T2.DEP_DELAY > 0 GROUP BY T1.Description
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Among the flights on 2018/8/1, how many of them were scheduled to depart from John F. Kennedy International in New York?
Evidence: on 2018/8/1 refers to FL_DATE = '2018/8/1'; depart from refers to ORIGIN; John F. Kennedy International in New York refers to Description = 'New York, NY: John F. Kennedy International';
SQL: SELECT COUNT(T1.Code) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/1' AND T1.Description = 'New York, NY: John F. Kennedy International'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: For the flight on 2018/8/1 that was delayed for the longest time, which was the destination airport of this flight?
Evidence: on 2018/8/1 refers to FL_DATE = '2018/8/1';  delayed for the longest time refers to MAX(DEP_DELAY); destination airport refers to DEST;
SQL: SELECT T1.Description FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/1' ORDER BY T2.DEP_DELAY DESC LIMIT 1
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Among the flights departing from John F. Kennedy International, how many of them arrived earlier than scheduled?
Evidence: departing from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International'; arrived earlier than scheduled refers to ARR_DELAY < 0;
SQL: SELECT SUM(CASE WHEN T2.ARR_DELAY < 0 THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'New York, NY: John F. Kennedy International'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Among all the flights scheduled to depart from John F. Kennedy International on 2018/8/1, when was the earliest one scheduled to depart?
Evidence: depart from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International'; on 2018/8/1 refers to FL_DATE = '2018/8/1'; earliest one scheduled to depart refers to MIN(DEP_TIME);
SQL: SELECT T2.DEP_TIME FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/1' AND T1.Description = 'New York, NY: John F. Kennedy International' AND T2.DEP_TIME IS NOT NULL ORDER BY T2.DEP_TIME ASC LIMIT 1
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: How many flights on 2018/8/1 were operated by American Airlines Inc.?
Evidence: on 2018/8/1 refers to FL_DATE = '2018/8/1'; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';
SQL: SELECT COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1' AND T3.Description = 'American Airlines Inc.: AA'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Please list the flight numbers of all the flights operated by American Airlines Inc. that were scheduled to depart from John F. Kennedy International.
Evidence: flight numbers refers to OP_CARRIER_FL_NUM; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; depart from refers to ORIGIN; John F. Kennedy International refers to Description = 'New York, NY: John F. Kennedy International';
SQL: SELECT T2.OP_CARRIER_FL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA' AND T1.Description = 'New York, NY: John F. Kennedy International' AND T2.FL_DATE = '2018/8/1'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: How many flights operated by American Airlines Inc. on 2018/8/1 were faster than scheduled?
Evidence: American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; on 2018/8/1 refers to FL_DATE = '2018/8/1'; faster than scheduled refers to ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME;
SQL: SELECT SUM(CASE WHEN T2.ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1' AND T3.Description = 'American Airlines Inc.: AA'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: What is the flight number of the flight operated by American Airlines Inc. that had the longest delay in departure?
Evidence: flight numbers refers to OP_CARRIER_FL_NUM; American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; longest delay in departure refers to MAX(DEP_DELAY);
SQL: SELECT T1.OP_CARRIER_FL_NUM FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T1.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA' ORDER BY T1.DEP_TIME DESC LIMIT 1
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Among the flights operated by American Airlines Inc., how many of them were scheduled to land in New York?
Evidence: American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; land in New York refers to DEST = 'JFK';
SQL: SELECT SUM(CASE WHEN T2.DEST = 'JFK' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Among the flights operated by American Airlines Inc. on 2018/8/1, how many of them were cancelled?
Evidence: American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; on 2018/8/1 refers to FL_DATE = '2018/8/1'; cancelled refers to CANCELLED = 1;
SQL: SELECT SUM(CASE WHEN T2.CANCELLED = 1 THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1' AND T3.Description = 'American Airlines Inc.: AA'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Which airline operated more flights on 2018/8/1, American Airlines Inc. or Endeavor Air Inc.?
Evidence: SUM(Description = 'American Airlines Inc.: AA') > SUM(Description = 'Endeavor Air Inc.: 9E') means American Airlines Inc. operated more flights than  Endeavor Air Inc; SUM(Description = 'American Airlines Inc.: AA') < SUM(Description = 'Endeavor Air Inc.: 9E') means Endeavor Air Inc. operated more flights than American Airlines Inc.; on 2018/8/1 refers to FL_DATE = '2018/8/1';
SQL: SELECT CASE WHEN COUNT(CASE WHEN T3.Description = 'American Airlines Inc.: AA' THEN 1 ELSE NULL END) > COUNT(CASE WHEN T3.Description = 'Endeavor Air Inc.: 9E' THEN 1 ELSE NULL END) THEN 'American Airlines Inc.: AA' ELSE 'Endeavor Air Inc.: 9E' END AS RESULT FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T2.FL_DATE = '2018/8/1'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: What is the average departure delay time of flights operated by American Airlines Inc.?
Evidence: average departure delay time = DIVIDE(SUM(DEP_DELAY), COUNT(Code)); American Airlines Inc. refers to Description = 'American Airlines Inc.: AA';
SQL: SELECT AVG(T1.DEP_DELAY) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T1.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: How many flights on average does American Airlines Inc. operate every day in August, 2018?
Evidence: flights on average = DIVIDE(COUNT(Code), 31); American Airlines Inc. refers to Description = 'American Airlines Inc.: AA'; every day in August, 2018 refers to FL_DATE like '2018/8%';
SQL: SELECT CAST( SUM(CASE WHEN T2.FL_DATE LIKE '2018/8%' THEN 1 ELSE 0 END) AS REAL) / 31 FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN INNER JOIN `Air Carriers` AS T3 ON T2.OP_CARRIER_AIRLINE_ID = T3.Code WHERE T3.Description = 'American Airlines Inc.: AA'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: What is the number of air carriers in the database?
SQL: SELECT COUNT(Code) FROM `Air Carriers`
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Give the number of planes that took off from Los Angeles International airport on 2018/8/27.
Evidence: took off from refers to ORIGIN; Los Angeles International airport refers to Description = 'Los Angeles, CA: Los Angeles International'; on 2018/8/27 refers to FL_DATE = '2018/8/27';
SQL: SELECT SUM(CASE WHEN T2.FL_DATE = '2018/8/27' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'Los Angeles, CA: Los Angeles International'
Database: airline
Tables: Air Carriers, Airports, Airlines
Columns (table index, column name): -1, *, 0, Code, 0, Description, 1, Code, 1, Description, 2, FL_DATE, 2, OP_CARRIER_AIRLINE_ID, 2, TAIL_NUM, 2, OP_CARRIER_FL_NUM, 2, ORIGIN_AIRPORT_ID, 2, ORIGIN_AIRPORT_SEQ_ID, 2, ORIGIN_CITY_MARKET_ID, 2, ORIGIN, 2, DEST_AIRPORT_ID, 2, DEST_AIRPORT_SEQ_ID, 2, DEST_CITY_MARKET_ID, 2, DEST, 2, CRS_DEP_TIME, 2, DEP_TIME, 2, DEP_DELAY, 2, DEP_DELAY_NEW, 2, ARR_TIME, 2, ARR_DELAY, 2, ARR_DELAY_NEW, 2, CANCELLED, 2, CANCELLATION_CODE, 2, CRS_ELAPSED_TIME, 2, ACTUAL_ELAPSED_TIME, 2, CARRIER_DELAY, 2, WEATHER_DELAY, 2, NAS_DELAY, 2, SECURITY_DELAY, 2, LATE_AIRCRAFT_DELAY
Question: Provide the number of airplanes that landed on Oakland Airport on 2018/8/7.
Evidence: landed on refers to DEST; Oakland Airport refers to Description which contains 'Oakland'; on 2018/8/7 refers to FL_DATE = '2018/8/7';
SQL: SELECT SUM(CASE WHEN T1.Description LIKE '%Oakland%' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/7'