input
stringlengths
122
2.7k
output
stringlengths
24
805
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: How many times d...
SELECT COUNT(T2.occurrences) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'heròdot';
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write m...
SELECT pid FROM pages_words WHERE pid = ( SELECT pid FROM pages WHERE revision = 28278070 ) ORDER BY occurrences DESC LIMIT 1;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] biwords : lid [ INTEGER ] biwords.lid = langs.lid w1st [ INTEGER ] biwords.w1st = words.wid w2nd [ INTEGER ] biwords.w2nd = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the foll...
SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'que' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'gregorio' );
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] biwords : lid [ INTEGER ] biwords.lid = langs.lid w1st [ INTEGER ] biwords.w1st = words.wid w2nd [ INTEGER ] biwords.w2nd = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the foll...
SELECT COUNT(w1st) FROM biwords WHERE w2nd = ( SELECT wid FROM words WHERE word = 'base' );
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] langs_words : lid [ INTEGER ] langs_words.lid = langs.lid wid [ INTEGER ] langs_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: How many times o...
SELECT T2.occurrences FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'exemple' AND T2.lid = 1;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] langs_words : lid [ INTEGER ] langs_words.lid = langs.lid wid [ INTEGER ] langs_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: Which word that ...
SELECT T1.word FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = 274499 AND T2.lid = 1;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] biwords : lid [ INTEGER ] biwords.lid = langs.lid w1st [ INTEGER ] biwords.w1st = words.wid w2nd [ INTEGER ] biwords.w2nd = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the foll...
SELECT CAST(occurrences AS REAL) / ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'a' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'decimal' ) ) FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'a' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'base' );
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INT...
SELECT CAST(SUM(CASE WHEN T3.title = 'Art' THEN T2.occurrences ELSE 0 END) AS REAL) * 100 / SUM(T2.occurrences) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'grec';
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] Please write me a SQL statement that answers the following question: How many Wikipedia pages with over 4000 different words are there on th...
SELECT COUNT(lid) FROM pages WHERE lid = 1 AND words > 4000;
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the titles of all the Wikipedia pages on the Catalan langua...
SELECT title FROM pages WHERE lid = 1 AND words = 10 LIMIT 10;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: What is the word that occurs the most in the Catalan language? [/INST] [/INST]
SELECT word FROM words WHERE occurrences = ( SELECT MAX(occurrences) FROM words );
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the titles of the top 3 Wikipedia pages with the most diffe...
SELECT title FROM pages WHERE lid = 1 ORDER BY words DESC LIMIT 3;
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] Please write me a SQL statement that answers the following question: What is the revision ID for the page on Catalan titled "Arqueologia"? [...
SELECT revision FROM pages WHERE lid = 1 AND title = 'Arqueologia';
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] Please write me a SQL statement that answers the following question: Among the wikipedia pages on Catalan with more than 300 different words...
SELECT COUNT(lid) FROM pages WHERE lid = 1 AND words > 300 AND revision > 28330000;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the ...
SELECT T2.pid FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'nombre';
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: How many Wikiped...
SELECT COUNT(T2.pid) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'nombre' AND T2.occurrences > 5;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] biwords : lid [ INTEGER ] biwords.lid = langs.lid w1st [ INTEGER ] biwords.w1st = words.wid w2nd [ INTEGER ] biwords.w2nd = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the foll...
SELECT COUNT(T2.w1st) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w2nd WHERE T1.word = 'grec';
[INST] Here is a database schema: pages : pid [ INTEGER ] primary_key lid [ INTEGER ] pages.lid = langs.lid page [ INTEGER ] revision [ INTEGER ] title [ TEXT ] words [ INTEGER ] words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INT...
SELECT T3.title FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid INNER JOIN pages AS T3 ON T2.pid = T3.pid WHERE T1.word = 'grec' AND T2.occurrences = 52;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] biwords : lid [ INTEGER ] biwords.lid = langs.lid w1st [ INTEGER ] biwords.w1st = words.wid w2nd [ INTEGER ] biwords.w2nd = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the foll...
SELECT COUNT(T2.w2nd) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st WHERE T1.word = 'àbac' AND T2.occurrences > 10;
[INST] Here is a database schema: words : wid [ INTEGER ] primary_key word [ TEXT ] occurrences [ INTEGER ] pages_words : pid [ INTEGER ] pages_words.pid = pages.pid wid [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: What is the aver...
SELECT CAST(SUM(T2.occurrences) AS REAL) / COUNT(T1.wid) FROM words AS T1 INNER JOIN pages_words AS T2 ON T1.wid = T2.wid WHERE T1.word = 'grec';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND ORIGIN = 'JFK';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT DEST FROM Airlines WHERE FL_DATE = '2018/8/1' AND CANCELLED = 1 GROUP BY DEST;
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT FL_DATE FROM Airlines WHERE CANCELLATION_CODE = 'A' GROUP BY FL_DATE;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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;
[INST] Please write me a SQL statement that answers the following question: How many flights on 2018/8/1 were operated by American Airlines Inc.? [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following 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. [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following question: How many flights operated by American Airlines Inc. on 2018/8/1 were faster than scheduled? [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following question: What is the flight number of the flight operated by American Airlines Inc. that had the longest delay in departure? [/INST] [/INST]
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;
[INST] Please write me a SQL statement that answers the following question: Among the flights operated by American Airlines Inc., how many of them were scheduled to land in New York? [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following question: Among the flights operated by American Airlines Inc. on 2018/8/1, how many of them were cancelled? [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following question: Which airline operated more flights on 2018/8/1, American Airlines Inc. or Endeavor Air Inc.? [/INST] [/INST]
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...
[INST] Please write me a SQL statement that answers the following question: What is the average departure delay time of flights operated by American Airlines Inc.? [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following question: How many flights on average does American Airlines Inc. operate every day in August, 2018? [/INST] [/INST]
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';
[INST] Please write me a SQL statement that answers the following question: What is the number of air carriers in the database? [/INST] [/INST]
SELECT COUNT(Code) FROM `Air Carriers`;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
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';
[INST] Please write me a SQL statement that answers the following question: How many flights of Alaska Airlines were delayed on 2018/8/2? [/INST] [/INST]
SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/2' AND T2.Description = 'Alaska Airlines Inc.: AS' AND T1.DEP_DELAY > 0;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/12' AND T2.DEST = 'MIA' AND T2.ARR_DELAY < 0;
[INST] Please write me a SQL statement that answers the following question: How many flights from American Airlines were cancelled due to a type A cancellation code? [/INST] [/INST]
SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.CANCELLATION_CODE = 'A' AND T2.Description = 'American Airlines Inc.: AA' AND T1.CANCELLED = 1;
[INST] Please write me a SQL statement that answers the following question: How many flights of Endeavor Air Inc. were faster than scheduled on 2018/8/31? [/INST] [/INST]
SELECT SUM(CASE WHEN T1.ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS count FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/31' AND T2.Description = 'Endeavor Air Inc.: 9E';
[INST] Please write me a SQL statement that answers the following question: How many planes of Spirit Air Lines took off on 2018/8/7? [/INST] [/INST]
SELECT COUNT(T2.Code) FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/7' AND T2.Description = 'Spirit Air Lines: NK';
[INST] Please write me a SQL statement that answers the following question: For the flight with the tail number 'N702SK', which air carrier does it belong to? [/INST] [/INST]
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.TAIL_NUM = 'N702SK' GROUP BY T2.Description;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT T1.Description FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/15' ORDER BY T2.DEST DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: For the flight from ATL to PHL on 2018/8/1 that scheduled local departure time as "2040", which air carrier does this flight belong to? [/INST] [/INST]
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.FL_DATE = '2018/8/1' AND T1.ORIGIN = 'ATL' AND T1.DEST = 'PHL' AND T1.CRS_DEP_TIME = '2040' GROUP BY T2.Description;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT COUNT(T1.Code) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/15' AND T1.Description = 'Lake Charles, LA: Lake Charles Regional';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT COUNT(FL_DATE) FROM Airlines WHERE FL_DATE LIKE '2018/8%' AND ORIGIN = ( SELECT T2.ORIGIN FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'San Diego, CA: San Diego International' ) AND DEST = ( SELECT T4.DEST FROM Airports AS T3 INNER JOIN Airlines AS T4 ON T3.Code = T...
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT CAST(SUM(CASE WHEN T2.CANCELLATION_CODE = 'C' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/15' AND T2.CANCELLATION_CODE IS NOT NULL AND T1.Description = 'Los Angeles, CA: Los Angeles International';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT CAST(SUM(CASE WHEN T1.ACTUAL_ELAPSED_TIME < T1.CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.DEST WHERE T2.Description LIKE '%Pittsburgh%' AND T1.CRS_ELAPSED_TIME IS NOT NULL AND T1.ACTUAL_ELAPSED_TIME IS NOT NULL;
[INST] Please write me a SQL statement that answers the following question: What is the description of the airline code 19049? [/INST] [/INST]
SELECT Description FROM `Air Carriers` WHERE Code = 19049;
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND DEP_DELAY <= 0;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: What are the codes of the airport found in Ankara, Turkey? [/INST] [/INST]
SELECT Code FROM Airports WHERE Description LIKE '%Ankara, Turkey%';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT WEATHER_DELAY FROM Airlines WHERE ORIGIN_AIRPORT_ID = 12264 ORDER BY WEATHER_DELAY DESC LIMIT 1;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: What is the IATA code of the Anita Bay Airport in Anita Bay, Alaska? [/INST] [/INST]
SELECT Code FROM Airports WHERE Description = 'Anita Bay, AK: Anita Bay Airport';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT ORIGIN_AIRPORT_ID FROM Airlines ORDER BY LATE_AIRCRAFT_DELAY DESC LIMIT 1;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT COUNT(FL_DATE) FROM Airlines WHERE ORIGIN = ( SELECT T2.ORIGIN FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T1.Description = 'Chicago, IL: Chicago O''Hare International' ) AND DEST = ( SELECT T4.DEST FROM Airports AS T3 INNER JOIN Airlines AS T4 ON T3.Code = T4.DEST WHERE T3.Descrip...
[INST] Please write me a SQL statement that answers the following question: How many planes does Southwest Airlines Co. have? [/INST] [/INST]
SELECT COUNT(T3.TAIL_NUM) FROM ( SELECT T1.TAIL_NUM FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T2.Description = 'Southwest Airlines Co.: WN' GROUP BY T1.TAIL_NUM ) T3;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT T2.FL_DATE FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International' AND T2.ORIGIN = 'DFW' AND T2.CANCELLED = 1 AND T2.CANCELLATION_CODE = 'A' GROUP BY T2.FL_DATE ORDER BY COUNT(T2.FL_DATE) DE...
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT T2.TAIL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Bakersfield, CA: Meadows Field' AND T2.DEST = 'BFL' AND T2.ARR_DELAY <= 0 GROUP BY T2.TAIL_NUM;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT T2.OP_CARRIER_AIRLINE_ID FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T1.Description = 'Boston, MA: Logan International' AND T2.DEST = 'BOS' ORDER BY T2.SECURITY_DELAY DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: What are the names of the top 5 airlines with the highest number of aircraft? [/INST] [/INST]
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code GROUP BY T2.Description ORDER BY T1.TAIL_NUM DESC LIMIT 5;
[INST] Please write me a SQL statement that answers the following question: What is the name of the airline with the highest number of non-cancelled flights? [/INST] [/INST]
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.CANCELLED = 0 GROUP BY T2.Description ORDER BY COUNT(T1.CANCELLED) DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: Give the name of the airline to which tail number N202NN belongs to. [/INST] [/INST]
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.TAIL_NUM = 'N202NN' GROUP BY T2.Description;
[INST] Please write me a SQL statement that answers the following question: What is the name of the airline that flew the most flights to Chicago Midway International? [/INST] [/INST]
SELECT T3.Description 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 T1.Description = 'Chicago, IL: Chicago Midway International' AND T2.DEST = 'MDW' GROUP BY T3.Description ORDER BY COUNT(T3.Description) DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: What is the tail number of a Compass Airline's plane that flew the most number of flights from LAX to ABQ? [/INST] [/INST]
SELECT T2.OP_CARRIER_AIRLINE_ID FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Compass Airlines: CP' AND T2.ORIGIN = 'LAX' AND T2.DEST = 'ABQ' GROUP BY T2.OP_CARRIER_AIRLINE_ID ORDER BY COUNT(T2.OP_CARRIER_AIRLINE_ID) DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: Which airport did Republic Airline fly the most from? [/INST] [/INST]
SELECT T2.DEST FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Republic Airline: YX' GROUP BY T2.DEST ORDER BY COUNT(T2.DEST) DESC LIMIT 1;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT T1.OP_CARRIER_AIRLINE_ID FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T1.ORIGIN = T2.Code WHERE T1.ACTUAL_ELAPSED_TIME IS NOT NULL AND T1.CRS_ELAPSED_TIME IS NOT NULL ORDER BY T1.ACTUAL_ELAPSED_TIME - T1.CRS_ELAPSED_TIME ASC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: How many hours in total did all of the Delta Air Lines aircraft were delayed due to a late aircraft in August of 2018? Identify the plane number of the aircraft with the highest delayed hours. [/INST] [/INST]
SELECT T1.TAIL_NUM, SUM(CAST(T1.LATE_AIRCRAFT_DELAY AS REAL) / 60) AS delay FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T2.Code = T1.OP_CARRIER_AIRLINE_ID WHERE T1.FL_DATE LIKE '2018/8/%' AND T2.Description = 'Delta Air Lines Inc.: DL' ORDER BY delay DESC LIMIT 1;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: Please list any three airports with their codes. [/INST] [/INST]
SELECT Code, Description FROM Airports LIMIT 3;
[INST] Please write me a SQL statement that answers the following question: What is the code of Mississippi Valley Airlines? [/INST] [/INST]
SELECT Code FROM `Air Carriers` WHERE Description LIKE 'Mississippi Valley Airlines%';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT CRS_DEP_TIME, DEP_TIME FROM Airlines WHERE ORIGIN = 'PHL' AND DEST = 'MDT' AND TAIL_NUM = 'N627AE' AND FL_DATE = '2018/8/13';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND ORIGIN = 'ABE';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT DEST FROM Airlines WHERE ORIGIN = 'ABY' GROUP BY DEST;
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) FROM Airlines WHERE DEST = 'SNA' AND ORIGIN = 'DFW' AND DEP_DELAY = 0;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORI...
SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T1.ORIGIN = T2.Code WHERE T1.ORIGIN = 'CLT' AND T1.DEST = 'AUS' AND T2.Description = 'Charlotte, NC: Charlotte Douglas International' AND T1.CANCELLATION_CODE = 'A';
[INST] Please write me a SQL statement that answers the following question: Which flight carrier operator has the most cancelled flights? [/INST] [/INST]
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.CANCELLED DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: What is the actual departure time of JetBlue Airways with the plane's tail number N903JB to Fort Lauderdale-Hollywood International Airport on the 20th of August 2018? [/INST] [/INST]
SELECT T1.DEP_TIME FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code INNER JOIN Airports AS T3 ON T1.DEST = T3.Code WHERE T1.FL_DATE = '2018/8/20' AND T1.TAIL_NUM = 'N903JB' AND T2.Description LIKE '%JetBlue Airways%' AND T3.Description LIKE '%Fort Lauderdale-Hollywood%';
[INST] Please write me a SQL statement that answers the following question: Which flight carrier operator flies from Atlantic City to Fort Lauderdale? [/INST] [/INST]
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T1.ORIGIN = 'ACY' AND T1.DEST = 'FLL' GROUP BY T2.Description;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: What is the airport description of the airport code A11? [/INST] [/INST]
SELECT Description FROM Airports WHERE Code = 'A11';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) AS num FROM Airlines WHERE Origin = 'OKC';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: How many airports have a code starting with the letter C? [/INST] [/INST]
SELECT COUNT(*) FROM Airports WHERE Code LIKE 'C%';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT DEST FROM Airlines WHERE OP_CARRIER_FL_NUM = 1596;
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: List the description of the airports that have code that ends with number 3? [/INST] [/INST]
SELECT Description FROM Airports WHERE Code LIKE '%3';
[INST] Here is a database schema: Airports : Code [ TEXT ] primary_key Description [ TEXT ] Please write me a SQL statement that answers the following question: Give the code of the airport described as Driftwood Bay, AK: Driftwood Bay Airport. [/INST] [/INST]
SELECT Code FROM Airports WHERE Description = 'Driftwood Bay, AK: Driftwood Bay Airport';
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT COUNT(*) FROM Airlines WHERE CANCELLED = 1;
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT TAIL_NUM FROM Airlines WHERE FL_DATE = '2018/8/17' GROUP BY TAIL_NUM;
[INST] Here is a database schema: Airlines : FL_DATE [ TEXT ] OP_CARRIER_AIRLINE_ID [ INTEGER ] Airlines.OP_CARRIER_AIRLINE_ID = Air Carriers.Code TAIL_NUM [ TEXT ] OP_CARRIER_FL_NUM [ INTEGER ] ORIGIN_AIRPORT_ID [ INTEGER ] ORIGIN_AIRPORT_SEQ_ID [ INTEGER ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.OR...
SELECT ORIGIN FROM Airlines ORDER BY ACTUAL_ELAPSED_TIME ASC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: Provide the date and tail number of flight with air carrier "Ross Aviation Inc.: GWE". [/INST] [/INST]
SELECT T1.FL_DATE, T1.TAIL_NUM FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T1.OP_CARRIER_AIRLINE_ID = T2.Code WHERE T2.Description = 'Ross Aviation Inc.: GWE';
[INST] Please write me a SQL statement that answers the following question: List the air carrier description and code of the flight with the shortest arrival time. [/INST] [/INST]
SELECT T1.Description, T1.Code FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ARR_TIME ASC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: How many flights of air carrier called JetBlue Airways: B6 have 0 new arrival delay? [/INST] [/INST]
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%JetBlue Airways: B6%' AND T2.ARR_DELAY_NEW = 0;
[INST] Please write me a SQL statement that answers the following question: Provide the air carrier description of all flights arriving at Miami. [/INST] [/INST]
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'MIA';
[INST] Please write me a SQL statement that answers the following question: What is the air carrier's description of the cancelled flights? [/INST] [/INST]
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.CANCELLED = 1 GROUP BY T1.Description;
[INST] Please write me a SQL statement that answers the following question: Give the actual elapsed time of the flights with air carrier named Semo Aviation Inc.: SEM. [/INST] [/INST]
SELECT T2.ACTUAL_ELAPSED_TIME FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Semo Aviation Inc.: SEM';
[INST] Please write me a SQL statement that answers the following question: Among the flights with air carrier described as Asap Air Inc.: ASP, what is the tail number of the flight with the longest departure delay? [/INST] [/INST]
SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Asap Air Inc.: ASP' ORDER BY T2.DEP_DELAY DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: List the air carrier's description of the flights with 0 departure delay. [/INST] [/INST]
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEP_DELAY = 0 GROUP BY T1.Description;
[INST] Please write me a SQL statement that answers the following question: Provide the air carrier description of the flight with the highest actual elapsed time. [/INST] [/INST]
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID ORDER BY T2.ACTUAL_ELAPSED_TIME DESC LIMIT 1;