input
stringlengths
193
2.69k
output
stringlengths
24
744
[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: State the Wikipedia page title that has revision page id of 28040864. [/INST]
SELECT title FROM pages WHERE revision = 28040864;
[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 following question: How many times that the word pair of "barcelona" and "precolombina" occur? [/INST]
SELECT SUM(occurrences) FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'barcelona' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'precolombina' );
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ INTEGER ] 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 locale of the language of the page titled "Anys 90"? [/INST]
SELECT T1.locale FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T2.title = 'Anys 90';
[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 has 71303 appearance in the Catalan language? [/INST]
SELECT T1.word FROM words AS T1 INNER JOIN langs_words AS T2 ON T1.wid = T2.wid WHERE T2.occurrences = 71303;
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ INTEGER ] 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 locale of the language of the page titled "Abril"? [/INST]
SELECT T1.locale FROM langs AS T1 INNER JOIN pages AS T2 ON T1.lid = T2.lid WHERE T2.title = 'Abril';
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ 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 following question: What is the total number of words in page containing pair of word id "100" and "317"? [/INST]
SELECT words FROM langs WHERE lid = ( SELECT lid FROM biwords WHERE w1st = 100 AND w2nd = 317 );
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ 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: State the total pages of the words that has repeated times of 2593. [/INST]
SELECT COUNT(T1.pages) FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T2.occurrences = 2593;
[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 me a SQL statement that answers the following question: List out the title of the word have id less than 20. [/INST]
SELECT DISTINCT T1.title FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.wid < 20;
[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 me a SQL statement that answers the following question: How many word that has number of different words equal to 3? [/INST]
SELECT COUNT(T2.wid) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.words = 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 ] 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 word appeared 8 times? State the language id of the page. [/INST]
SELECT COUNT(T2.wid), T1.lid FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T2.occurrences = 8;
[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 me a SQL statement that answers the following question: Calculate the average percentage of word appearance in the page that have revision page id smaller than 106680. [/INST]
SELECT CAST(SUM(T1.words) AS REAL) * 100 / SUM(T2.occurrences) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.revision < 106680;
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ 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: List out the total pages of the words that has repeated times more than 3000. [/INST]
SELECT T1.pages FROM langs AS T1 INNER JOIN langs_words AS T2 ON T1.lid = T2.lid WHERE T2.occurrences > 3000 GROUP BY T1.pages;
[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 following question: State the name of the pair of word that have id of 20 and 50? [/INST]
SELECT T1.word, T3.word FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T2.w1st = 20 AND T2.w2nd = 50;
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ INTEGER ] Please write me a SQL statement that answers the following question: How many pages of Wikipedia are there in total on the Catalan language? [/INST]
SELECT pages FROM langs WHERE lang = 'ca';
[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 Wikipedia pages on the Catalan language with more than 4000 words. [/INST]
SELECT title 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: How many words are there on the page titled "Asclepi"? [/INST]
SELECT words FROM pages WHERE title = 'Asclepi';
[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: Which of these pages have more words, the page titled "Afluent" or "Asclepi"? [/INST]
SELECT CASE WHEN ( SELECT words FROM pages WHERE title = 'Asclepi' ) > ( SELECT words FROM pages WHERE title = 'Afluent' ) THEN 'Asclepi' ELSE 'Afluent' END;
[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 occurrence of the word "nombre"? [/INST]
SELECT occurrences FROM words WHERE word = 'nombre';
[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: Please list the Catalan words with an occurrence of over 200000. [/INST]
SELECT word FROM words WHERE occurrences > 200000;
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ INTEGER ] 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 locale of the language of the page titled "Asclepi"? [/INST]
SELECT T2.locale FROM pages AS T1 INNER JOIN langs AS T2 ON T1.lid = T2.lid WHERE T1.title = 'Asclepi';
[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 [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: How many times did the word "grec" occur on the page titled "Àbac"? [/INST]
SELECT 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 T3.title = 'Àbac' AND 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 [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the title of the pages on which the word "grec" occurred for over 20 times. [/INST]
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 > 20;
[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 [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: How many words are there on the page that the word "grec" has occurred for 52 times? [/INST]
SELECT SUM(T3.words) 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 following question: What's the occurrence of the biwords pair whose first word is "àbac" and second word is "xinès"? [/INST]
SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' );
[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 following question: Which biwords pair has a higher occurrence, "àbac-xinès" or "àbac-grec"? [/INST]
SELECT CASE WHEN ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) > ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'grec' ) ) THEN 'àbac-xinès' ELSE 'àbac-grec' END AS CALUS FROM words 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 following question: How many more times does the first word in the biwords pair "àbac-xinès" occur than the biwords pair itself? [/INST]
SELECT occurrences - ( SELECT occurrences FROM biwords WHERE w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND w2nd = ( SELECT wid FROM words WHERE word = 'xinès' ) ) AS CALUS FROM words WHERE word = 'àbac';
[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 following question: Please list all the biwords pairs with "àbac" as its first word. [/INST]
SELECT T1.word AS W1, T3.word AS W2 FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'àbac';
[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 following question: What is the total occurrence of the biwords pairs with "àbac" as its first word? [/INST]
SELECT COUNT(T2.w1st) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'àbac';
[INST] Here is a database schema: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ INTEGER ] 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 following question: How many Wikipedia pages are there on the language of the biwords pair "àbac-xinès"? [/INST]
SELECT COUNT(T1.pages) FROM langs AS T1 INNER JOIN biwords AS T2 ON T1.lid = T2.lid WHERE T2.w1st = ( SELECT wid FROM words WHERE word = 'àbac' ) AND T2.w2nd = ( SELECT wid FROM words WHERE word = 'xinès' );
[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 [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: How much higher in percentage does the word "grec" occur on the page titled "Àbac" than on the page titled "Astronomia"? [/INST]
SELECT CAST((SUM(CASE WHEN T3.title = 'Àbac' THEN T2.occurrences END) - SUM(CASE WHEN T3.title = 'Astronomia' THEN T2.occurrences END)) AS REAL) * 100 / SUM(CASE WHEN T3.title = 'Astronomia' THEN T2.occurrences END) 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: langs : lid [ INTEGER ] primary_key lang [ TEXT ] locale [ TEXT ] pages [ INTEGER ] words [ INTEGER ] Please write me a SQL statement that answers the following question: How many pages does the Catalan language have in Wikipedia? [/INST]
SELECT pages FROM langs WHERE lang = 'ca';
[INST] Here is a database schema: 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 has the most repetitions in the Catalan language? Give the ID of the word. [/INST]
SELECT wid FROM langs_words WHERE occurrences = ( SELECT MAX(occurrences) FROM langs_words );
[INST] Here is a database schema: 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 following question: What is the word ID for the second word for the biwords pair with most repetitions? [/INST]
SELECT w2nd FROM biwords WHERE occurrences = ( SELECT MAX(occurrences) FROM biwords );
[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: How many occurrences does the word "panajot" have? [/INST]
SELECT occurrences FROM words WHERE word = 'panajot';
[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: Which word has the time of occurrences as 340691? [/INST]
SELECT word FROM words WHERE occurrences = 340691;
[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: State the word ID for "periodograma". [/INST]
SELECT wid FROM words WHERE word = 'periodograma';
[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 following question: For the biwords pair that appears "116430" times, what is the second word of the pair? [/INST]
SELECT T1.word FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w2nd WHERE T2.occurrences = 116430;
[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 following question: How many times does the word "riu" appears in the biwords pair? [/INST]
SELECT COUNT(T1.wid) FROM words AS T1 INNER JOIN biwords AS T2 ON T1.wid = T2.w1st INNER JOIN words AS T3 ON T3.wid = T2.w2nd WHERE T1.word = 'riu';
[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 me a SQL statement that answers the following question: Which word has the most appearances in the Wikipedia page with the title of "Agricultura"? Give the word ID. [/INST]
SELECT T2.wid FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Agricultura' ORDER BY T2.occurrences DESC LIMIT 1;
[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 me a SQL statement that answers the following question: How many appearances does the word ID No. 2823 have in the Wikipedia page "Astre"? [/INST]
SELECT SUM(T2.occurrences) FROM pages AS T1 INNER JOIN pages_words AS T2 ON T1.pid = T2.pid WHERE T1.title = 'Astre' AND T2.wid = 2823;
[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 me a SQL statement that answers the following question: In which Wikipedia page does the word ID No. 174 have the most appearances? Give the title. [/INST]
SELECT title FROM pages WHERE pid = ( SELECT pid FROM pages_words WHERE wid = 174 ORDER BY occurrences DESC LIMIT 1 );
[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 does the word "heròdot" appear in the Wikipedia page? [/INST]
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 me a SQL statement that answers the following question: Which word has the most appearances in the Wikipedia page revision ID No. 28278070? Give the word ID. [/INST]
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 following question: How many times does the biwords "que gregorio" appear in the language? [/INST]
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 following question: How many biword pairs contain the word "base" as the second word? [/INST]
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 of repetition does the word "exemple" show in the Catalan language? [/INST]
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 has 274499 repetitions in the Catalan language? [/INST]
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 following question: How many times greater is the appearances of the biword pair "a base" than "a decimal"? [/INST]
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 [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: For the word "grec", what is the percentage of the appearances in the "Art" Wikipedia page have among all the appearances? [/INST]
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 the Catalan language? [/INST]
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 language with 10 different words. [/INST]
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]
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 different words on the Catalan language. [/INST]
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"? [/INST]
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, how many of them have a revision ID of over 28330000? [/INST]
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 page IDs of all the Wikipedia pages that have the word "nombre" appeared on it. [/INST]
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 Wikipedia pages on Catalan are there with the word "nombre" appearing for more than 5 times? [/INST]
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 following question: How many biwords pairs are there whose second word is "grec"? [/INST]
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 [ INTEGER ] pages_words.wid = words.wid occurrences [ INTEGER ] Please write me a SQL statement that answers the following question: What is the title of the page on which the word "grec" has an occurrence of 52 times. [/INST]
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 following question: Among the biwords pairs with "àbac" as its first word, how many of them have an occurrence of over 10? [/INST]
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 average occurrence of the word "grec" on each Wikipedia page that has this word? [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights were there on 2018/8/1? [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Among the flights on 2018/8/1, how many of them departed from an airport in New York? [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the destination cities of all the flights that were cancelled on 2018/8/1. [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the dates of the flights that were cancelled due to the most serious reason. [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the departure airports of the flights on 2018/8/1 that were delayed. [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Among the flights on 2018/8/1, how many of them were scheduled to depart from John F. Kennedy International in New York? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: For the flight on 2018/8/1 that was delayed for the longest time, which was the destination airport of this flight? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Among the flights departing from John F. Kennedy International, how many of them arrived earlier than scheduled? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following 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? [/INST]
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] 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Give the number of planes that took off from Los Angeles International airport on 2018/8/27. [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the number of airplanes that landed on Oakland Airport on 2018/8/7. [/INST]
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] 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Tell the number of fights landed earlier on Miami Airport on 2018/8/12. [/INST]
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] 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the name of the airport which landed the most number of flights on 2018/8/15. [/INST]
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] 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Tell the number of flights that landed at Lake Charles Regional Airport on 2018/8/15. [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights were there from San Diego International airport to Los Angeles International airport in the August of 2018? [/INST]
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 = T4.DEST WHERE T3.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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: What is the percentage of flights from Los Angeles International airport that were cancelled due to a type C cancellation code? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: What is the percentage of flights which landed at Pittsburgh were faster than scheduled? [/INST]
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] 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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights departed on time on 8/1/2018? [/INST]
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]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How long was the longest minute delay caused by a weather problem in airport id 12264? [/INST]
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]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: What is the origin airport id that recorded the longest delay due to a late aircraft? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights depart to Hartsfield-Jackson Atlanta International from Chicago O'Hare International? [/INST]
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.Description = 'Atlanta, GA: Hartsfield-Jackson Atlanta 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: On August 2018, which day had the highest number of cancelled flights due to the most serious reasons in Dallas/Fort Worth International? [/INST]
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) 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: List the tail numbers of all the aircraft that arrived on time at Meadows Field airport in August of 2018? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Among the airports whose destination is Logan International, what is the airline id of the carrier operator with the highest delay in minutes due to security? [/INST]
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] 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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Which airline does the aircraft with the fastest flight belong to? [/INST]
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] 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]
SELECT Code, Description FROM Airports LIMIT 3;
[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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: What is the scheduled local departure time and the actual departure time of the flight from Philadelphia to Harrisburg with the plane's tail number N627AE on the 13th of August 2018? [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights on the 1st of August 2018 were coming from Allentown, Pennsylvania? [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: What is the only flight destination for flights from Albany? [/INST]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights from Dallas to Santa Ana departed on time? [/INST]
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 ] ORIGIN_CITY_MARKET_ID [ INTEGER ] ORIGIN [ TEXT ] Airlines.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: How many flights from Charlotte Douglas International Airport to Austin - Bergstrom International Airport experienced serious reasons that cause flight cancellation? [/INST]
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] 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]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: What is the total number of flights that have Oklahoma as their origin? [/INST]
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]
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.ORIGIN = Airports.Code DEST_AIRPORT_ID [ INTEGER ] DEST_AIRPORT_SEQ_ID [ INTEGER ] DEST_CITY_MARKET_ID [ INTEGER ] DEST [ TEXT ] Airlines.DEST = Airports.Code CRS_DEP_TIME [ INTEGER ] DEP_TIME [ INTEGER ] DEP_DELAY [ INTEGER ] DEP_DELAY_NEW [ INTEGER ] ARR_TIME [ INTEGER ] ARR_DELAY [ INTEGER ] ARR_DELAY_NEW [ INTEGER ] CANCELLED [ INTEGER ] CANCELLATION_CODE [ TEXT ] CRS_ELAPSED_TIME [ INTEGER ] ACTUAL_ELAPSED_TIME [ INTEGER ] CARRIER_DELAY [ INTEGER ] WEATHER_DELAY [ INTEGER ] NAS_DELAY [ INTEGER ] SECURITY_DELAY [ INTEGER ] LATE_AIRCRAFT_DELAY [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the destinations of flight number 1596. [/INST]
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]
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]
SELECT Code FROM Airports WHERE Description = 'Driftwood Bay, AK: Driftwood Bay Airport';