db_id
stringclasses
140 values
schema
listlengths
0
26
question
stringlengths
16
224
query
stringlengths
18
577
query_toks
listlengths
4
90
query_toks_no_value
listlengths
4
125
question_toks
listlengths
4
44
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
How many budgets are above 3000 in year 2001 or before?
SELECT count(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001
[ "SELECT", "count", "(", "*", ")", "FROM", "budget", "WHERE", "budgeted", ">", "3000", "AND", "YEAR", "<", "=", "2001" ]
[ "select", "count", "(", "*", ")", "from", "budget", "where", "budgeted", ">", "value", "and", "year", "<", "=", "value" ]
[ "How", "many", "budgets", "are", "above", "3000", "in", "year", "2001", "or", "before", "?" ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
Count the number of budgets in year 2001 or before whose budgeted amount is greater than 3000
SELECT count(*) FROM budget WHERE budgeted > 3000 AND YEAR <= 2001
[ "SELECT", "count", "(", "*", ")", "FROM", "budget", "WHERE", "budgeted", ">", "3000", "AND", "YEAR", "<", "=", "2001" ]
[ "select", "count", "(", "*", ")", "from", "budget", "where", "budgeted", ">", "value", "and", "year", "<", "=", "value" ]
[ "Count", "the", "number", "of", "budgets", "in", "year", "2001", "or", "before", "whose", "budgeted", "amount", "is", "greater", "than", "3000" ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
Show each school name, its budgeted amount, and invested amount in year 2002 or after.
SELECT T2.school_name , T1.budgeted , T1.invested FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.year >= 2002
[ "SELECT", "T2.school_name", ",", "T1.budgeted", ",", "T1.invested", "FROM", "budget", "AS", "T1", "JOIN", "school", "AS", "T2", "ON", "T1.school_id", "=", "T2.school_id", "WHERE", "T1.year", ">", "=", "2002" ]
[ "select", "t2", ".", "school_name", ",", "t1", ".", "budgeted", ",", "t1", ".", "invested", "from", "budget", "as", "t1", "join", "school", "as", "t2", "on", "t1", ".", "school_id", "=", "t2", ".", "school_id", "where", "t1", ".", "year", ">", "=", "value" ]
[ "Show", "each", "school", "name", ",", "its", "budgeted", "amount", ",", "and", "invested", "amount", "in", "year", "2002", "or", "after", "." ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
Show all donor names.
SELECT DISTINCT donator_name FROM endowment
[ "SELECT", "DISTINCT", "donator_name", "FROM", "endowment" ]
[ "select", "distinct", "donator_name", "from", "endowment" ]
[ "Show", "all", "donor", "names", "." ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
How many budget record has a budget amount smaller than the invested amount?
SELECT count(*) FROM budget WHERE budgeted < invested
[ "SELECT", "count", "(", "*", ")", "FROM", "budget", "WHERE", "budgeted", "<", "invested" ]
[ "select", "count", "(", "*", ")", "from", "budget", "where", "budgeted", "<", "invested" ]
[ "How", "many", "budget", "record", "has", "a", "budget", "amount", "smaller", "than", "the", "invested", "amount", "?" ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
What is the total budget amount for school "Glenn" in all years?
SELECT sum(T1.budgeted) FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn'
[ "SELECT", "sum", "(", "T1.budgeted", ")", "FROM", "budget", "AS", "T1", "JOIN", "school", "AS", "T2", "ON", "T1.school_id", "=", "T2.school_id", "WHERE", "T2.school_name", "=", "'Glenn", "'" ]
[ "select", "sum", "(", "t1", ".", "budgeted", ")", "from", "budget", "as", "t1", "join", "school", "as", "t2", "on", "t1", ".", "school_id", "=", "t2", ".", "school_id", "where", "t2", ".", "school_name", "=", "value" ]
[ "What", "is", "the", "total", "budget", "amount", "for", "school", "``", "Glenn", "''", "in", "all", "years", "?" ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
Show the names of schools with a total budget amount greater than 100 or a total endowment greater than 10.
SELECT T2.school_name FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN endowment AS T3 ON T2.school_id = T3.school_id GROUP BY T2.school_name HAVING sum(T1.budgeted) > 100 OR sum(T3.amount) > 10
[ "SELECT", "T2.school_name", "FROM", "budget", "AS", "T1", "JOIN", "school", "AS", "T2", "ON", "T1.school_id", "=", "T2.school_id", "JOIN", "endowment", "AS", "T3", "ON", "T2.school_id", "=", "T3.school_id", "GROUP", "BY", "T2.school_name", "HAVING", "sum", "(", "T1.budgeted", ")", ">", "100", "OR", "sum", "(", "T3.amount", ")", ">", "10" ]
[ "select", "t2", ".", "school_name", "from", "budget", "as", "t1", "join", "school", "as", "t2", "on", "t1", ".", "school_id", "=", "t2", ".", "school_id", "join", "endowment", "as", "t3", "on", "t2", ".", "school_id", "=", "t3", ".", "school_id", "group", "by", "t2", ".", "school_name", "having", "sum", "(", "t1", ".", "budgeted", ")", ">", "value", "or", "sum", "(", "t3", ".", "amount", ")", ">", "value" ]
[ "Show", "the", "names", "of", "schools", "with", "a", "total", "budget", "amount", "greater", "than", "100", "or", "a", "total", "endowment", "greater", "than", "10", "." ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
Find the names of schools that have more than one donator with donation amount above 8.5.
SELECT T2.School_name FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T1.amount > 8.5 GROUP BY T1.school_id HAVING count(*) > 1
[ "SELECT", "T2.School_name", "FROM", "endowment", "AS", "T1", "JOIN", "school", "AS", "T2", "ON", "T1.school_id", "=", "T2.school_id", "WHERE", "T1.amount", ">", "8.5", "GROUP", "BY", "T1.school_id", "HAVING", "count", "(", "*", ")", ">", "1" ]
[ "select", "t2", ".", "school_name", "from", "endowment", "as", "t1", "join", "school", "as", "t2", "on", "t1", ".", "school_id", "=", "t2", ".", "school_id", "where", "t1", ".", "amount", ">", "value", "group", "by", "t1", ".", "school_id", "having", "count", "(", "*", ")", ">", "value" ]
[ "Find", "the", "names", "of", "schools", "that", "have", "more", "than", "one", "donator", "with", "donation", "amount", "above", "8.5", "." ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
Find the number of schools that have more than one donator whose donation amount is less than 8.5.
SELECT count(*) FROM (SELECT * FROM endowment WHERE amount > 8.5 GROUP BY school_id HAVING count(*) > 1)
[ "SELECT", "count", "(", "*", ")", "FROM", "(", "SELECT", "*", "FROM", "endowment", "WHERE", "amount", ">", "8.5", "GROUP", "BY", "school_id", "HAVING", "count", "(", "*", ")", ">", "1", ")" ]
[ "select", "count", "(", "*", ")", "from", "(", "select", "*", "from", "endowment", "where", "amount", ">", "value", "group", "by", "school_id", "having", "count", "(", "*", ")", ">", "value", ")" ]
[ "Find", "the", "number", "of", "schools", "that", "have", "more", "than", "one", "donator", "whose", "donation", "amount", "is", "less", "than", "8.5", "." ]
school_finance
[ "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);", "CREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);", "CREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);" ]
List the name, IHSAA Football Class, and Mascot of the schools that have more than 6000 of budgeted amount or were founded before 2003, in the order of percent of total invested budget and total budgeted budget.
SELECT T1.School_name , T1.Mascot , T1.IHSAA_Football_Class FROM school AS T1 JOIN budget AS T2 ON T1.school_id = T2.school_id WHERE Budgeted > 6000 OR YEAR < 2003 ORDER BY T2.total_budget_percent_invested , T2.total_budget_percent_budgeted
[ "SELECT", "T1.School_name", ",", "T1.Mascot", ",", "T1.IHSAA_Football_Class", "FROM", "school", "AS", "T1", "JOIN", "budget", "AS", "T2", "ON", "T1.school_id", "=", "T2.school_id", "WHERE", "Budgeted", ">", "6000", "OR", "YEAR", "<", "2003", "ORDER", "BY", "T2.total_budget_percent_invested", ",", "T2.total_budget_percent_budgeted" ]
[ "select", "t1", ".", "school_name", ",", "t1", ".", "mascot", ",", "t1", ".", "ihsaa_football_class", "from", "school", "as", "t1", "join", "budget", "as", "t2", "on", "t1", ".", "school_id", "=", "t2", ".", "school_id", "where", "budgeted", ">", "value", "or", "year", "<", "value", "order", "by", "t2", ".", "total_budget_percent_invested", ",", "t2", ".", "total_budget_percent_budgeted" ]
[ "List", "the", "name", ",", "IHSAA", "Football", "Class", ",", "and", "Mascot", "of", "the", "schools", "that", "have", "more", "than", "6000", "of", "budgeted", "amount", "or", "were", "founded", "before", "2003", ",", "in", "the", "order", "of", "percent", "of", "total", "invested", "budget", "and", "total", "budgeted", "budget", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
How many buildings are there?
SELECT count(*) FROM building
[ "SELECT", "count", "(", "*", ")", "FROM", "building" ]
[ "select", "count", "(", "*", ")", "from", "building" ]
[ "How", "many", "buildings", "are", "there", "?" ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the name, street address, and number of floors for all buildings ordered by the number of floors.
SELECT name , street_address , floors FROM building ORDER BY floors
[ "SELECT", "name", ",", "street_address", ",", "floors", "FROM", "building", "ORDER", "BY", "floors" ]
[ "select", "name", ",", "street_address", ",", "floors", "from", "building", "order", "by", "floors" ]
[ "Show", "the", "name", ",", "street", "address", ",", "and", "number", "of", "floors", "for", "all", "buildings", "ordered", "by", "the", "number", "of", "floors", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
What is the name of the tallest building?
SELECT name FROM building ORDER BY height_feet DESC LIMIT 1
[ "SELECT", "name", "FROM", "building", "ORDER", "BY", "height_feet", "DESC", "LIMIT", "1" ]
[ "select", "name", "from", "building", "order", "by", "height_feet", "desc", "limit", "value" ]
[ "What", "is", "the", "name", "of", "the", "tallest", "building", "?" ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
What are the average, maximum, and minimum number of floors for all buildings?
SELECT avg(floors) , max(floors) , min(floors) FROM building
[ "SELECT", "avg", "(", "floors", ")", ",", "max", "(", "floors", ")", ",", "min", "(", "floors", ")", "FROM", "building" ]
[ "select", "avg", "(", "floors", ")", ",", "max", "(", "floors", ")", ",", "min", "(", "floors", ")", "from", "building" ]
[ "What", "are", "the", "average", ",", "maximum", ",", "and", "minimum", "number", "of", "floors", "for", "all", "buildings", "?" ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the number of buildings with a height above the average or a number of floors above the average.
SELECT count(*) FROM building WHERE height_feet > (SELECT avg(height_feet) FROM building) OR floors > (SELECT avg(floors) FROM building)
[ "SELECT", "count", "(", "*", ")", "FROM", "building", "WHERE", "height_feet", ">", "(", "SELECT", "avg", "(", "height_feet", ")", "FROM", "building", ")", "OR", "floors", ">", "(", "SELECT", "avg", "(", "floors", ")", "FROM", "building", ")" ]
[ "select", "count", "(", "*", ")", "from", "building", "where", "height_feet", ">", "(", "select", "avg", "(", "height_feet", ")", "from", "building", ")", "or", "floors", ">", "(", "select", "avg", "(", "floors", ")", "from", "building", ")" ]
[ "Show", "the", "number", "of", "buildings", "with", "a", "height", "above", "the", "average", "or", "a", "number", "of", "floors", "above", "the", "average", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
List the names of buildings with at least 200 feet of height and with at least 20 floors.
SELECT name FROM building WHERE height_feet >= 200 AND floors >= 20
[ "SELECT", "name", "FROM", "building", "WHERE", "height_feet", ">", "=", "200", "AND", "floors", ">", "=", "20" ]
[ "select", "name", "from", "building", "where", "height_feet", ">", "=", "value", "and", "floors", ">", "=", "value" ]
[ "List", "the", "names", "of", "buildings", "with", "at", "least", "200", "feet", "of", "height", "and", "with", "at", "least", "20", "floors", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the names and locations of institutions that are founded after 1990 and have the type "Private".
SELECT institution , LOCATION FROM institution WHERE founded > 1990 AND TYPE = 'Private'
[ "SELECT", "institution", ",", "LOCATION", "FROM", "institution", "WHERE", "founded", ">", "1990", "AND", "TYPE", "=", "'Private", "'" ]
[ "select", "institution", ",", "location", "from", "institution", "where", "founded", ">", "value", "and", "type", "=", "value" ]
[ "Show", "the", "names", "and", "locations", "of", "institutions", "that", "are", "founded", "after", "1990", "and", "have", "the", "type", "``", "Private", "''", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show institution types, along with the number of institutions and total enrollment for each type.
SELECT TYPE , count(*) , sum(enrollment) FROM institution GROUP BY TYPE
[ "SELECT", "TYPE", ",", "count", "(", "*", ")", ",", "sum", "(", "enrollment", ")", "FROM", "institution", "GROUP", "BY", "TYPE" ]
[ "select", "type", ",", "count", "(", "*", ")", ",", "sum", "(", "enrollment", ")", "from", "institution", "group", "by", "type" ]
[ "Show", "institution", "types", ",", "along", "with", "the", "number", "of", "institutions", "and", "total", "enrollment", "for", "each", "type", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the institution type with the largest number of institutions.
SELECT TYPE FROM institution GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "TYPE", "FROM", "institution", "GROUP", "BY", "TYPE", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "type", "from", "institution", "group", "by", "type", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Show", "the", "institution", "type", "with", "the", "largest", "number", "of", "institutions", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the institution type with an institution founded after 1990 and an institution with at least 1000 enrollment.
SELECT TYPE FROM institution WHERE founded > 1990 AND enrollment >= 1000
[ "SELECT", "TYPE", "FROM", "institution", "WHERE", "founded", ">", "1990", "AND", "enrollment", ">", "=", "1000" ]
[ "select", "type", "from", "institution", "where", "founded", ">", "value", "and", "enrollment", ">", "=", "value" ]
[ "Show", "the", "institution", "type", "with", "an", "institution", "founded", "after", "1990", "and", "an", "institution", "with", "at", "least", "1000", "enrollment", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the name of buildings that do not have any institution.
SELECT name FROM building WHERE building_id NOT IN (SELECT building_id FROM institution)
[ "SELECT", "name", "FROM", "building", "WHERE", "building_id", "NOT", "IN", "(", "SELECT", "building_id", "FROM", "institution", ")" ]
[ "select", "name", "from", "building", "where", "building_id", "not", "in", "(", "select", "building_id", "from", "institution", ")" ]
[ "Show", "the", "name", "of", "buildings", "that", "do", "not", "have", "any", "institution", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the names of buildings except for those having an institution founded in 2003.
SELECT name FROM building EXCEPT SELECT T1.name FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded = 2003
[ "SELECT", "name", "FROM", "building", "EXCEPT", "SELECT", "T1.name", "FROM", "building", "AS", "T1", "JOIN", "institution", "AS", "T2", "ON", "T1.building_id", "=", "T2.building_id", "WHERE", "T2.founded", "=", "2003" ]
[ "select", "name", "from", "building", "except", "select", "t1", ".", "name", "from", "building", "as", "t1", "join", "institution", "as", "t2", "on", "t1", ".", "building_id", "=", "t2", ".", "building_id", "where", "t2", ".", "founded", "=", "value" ]
[ "Show", "the", "names", "of", "buildings", "except", "for", "those", "having", "an", "institution", "founded", "in", "2003", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
For each building, show the name of the building and the number of institutions in it.
SELECT T1.name , count(*) FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id
[ "SELECT", "T1.name", ",", "count", "(", "*", ")", "FROM", "building", "AS", "T1", "JOIN", "institution", "AS", "T2", "ON", "T1.building_id", "=", "T2.building_id", "GROUP", "BY", "T1.building_id" ]
[ "select", "t1", ".", "name", ",", "count", "(", "*", ")", "from", "building", "as", "t1", "join", "institution", "as", "t2", "on", "t1", ".", "building_id", "=", "t2", ".", "building_id", "group", "by", "t1", ".", "building_id" ]
[ "For", "each", "building", ",", "show", "the", "name", "of", "the", "building", "and", "the", "number", "of", "institutions", "in", "it", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the names and heights of buildings with at least two institutions founded after 1880.
SELECT T1.name , T1.height_feet FROM building AS T1 JOIN institution AS T2 ON T1.building_id = T2.building_id WHERE T2.founded > 1880 GROUP BY T1.building_id HAVING count(*) >= 2
[ "SELECT", "T1.name", ",", "T1.height_feet", "FROM", "building", "AS", "T1", "JOIN", "institution", "AS", "T2", "ON", "T1.building_id", "=", "T2.building_id", "WHERE", "T2.founded", ">", "1880", "GROUP", "BY", "T1.building_id", "HAVING", "count", "(", "*", ")", ">", "=", "2" ]
[ "select", "t1", ".", "name", ",", "t1", ".", "height_feet", "from", "building", "as", "t1", "join", "institution", "as", "t2", "on", "t1", ".", "building_id", "=", "t2", ".", "building_id", "where", "t2", ".", "founded", ">", "value", "group", "by", "t1", ".", "building_id", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "Show", "the", "names", "and", "heights", "of", "buildings", "with", "at", "least", "two", "institutions", "founded", "after", "1880", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show all the distinct institution types.
SELECT DISTINCT TYPE FROM institution
[ "SELECT", "DISTINCT", "TYPE", "FROM", "institution" ]
[ "select", "distinct", "type", "from", "institution" ]
[ "Show", "all", "the", "distinct", "institution", "types", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show institution names along with the number of proteins for each institution.
SELECT T1.institution , count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id GROUP BY T1.institution_id
[ "SELECT", "T1.institution", ",", "count", "(", "*", ")", "FROM", "institution", "AS", "T1", "JOIN", "protein", "AS", "T2", "ON", "T1.institution_id", "=", "T2.institution_id", "GROUP", "BY", "T1.institution_id" ]
[ "select", "t1", ".", "institution", ",", "count", "(", "*", ")", "from", "institution", "as", "t1", "join", "protein", "as", "t2", "on", "t1", ".", "institution_id", "=", "t2", ".", "institution_id", "group", "by", "t1", ".", "institution_id" ]
[ "Show", "institution", "names", "along", "with", "the", "number", "of", "proteins", "for", "each", "institution", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
How many proteins are associated with an institution founded after 1880 or an institution with type "Private"?
SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id WHERE T1.founded > 1880 OR T1.type = 'Private'
[ "SELECT", "count", "(", "*", ")", "FROM", "institution", "AS", "T1", "JOIN", "protein", "AS", "T2", "ON", "T1.institution_id", "=", "T2.institution_id", "WHERE", "T1.founded", ">", "1880", "OR", "T1.type", "=", "'Private", "'" ]
[ "select", "count", "(", "*", ")", "from", "institution", "as", "t1", "join", "protein", "as", "t2", "on", "t1", ".", "institution_id", "=", "t2", ".", "institution_id", "where", "t1", ".", "founded", ">", "value", "or", "t1", ".", "type", "=", "value" ]
[ "How", "many", "proteins", "are", "associated", "with", "an", "institution", "founded", "after", "1880", "or", "an", "institution", "with", "type", "``", "Private", "''", "?" ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
Show the protein name and the institution name.
SELECT T2.protein_name , T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id
[ "SELECT", "T2.protein_name", ",", "T1.institution", "FROM", "institution", "AS", "T1", "JOIN", "protein", "AS", "T2", "ON", "T1.institution_id", "=", "T2.institution_id" ]
[ "select", "t2", ".", "protein_name", ",", "t1", ".", "institution", "from", "institution", "as", "t1", "join", "protein", "as", "t2", "on", "t1", ".", "institution_id", "=", "t2", ".", "institution_id" ]
[ "Show", "the", "protein", "name", "and", "the", "institution", "name", "." ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
How many proteins are associated with an institution in a building with at least 20 floors?
SELECT count(*) FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id JOIN building AS T3 ON T3.building_id = T1.building_id WHERE T3.floors >= 20
[ "SELECT", "count", "(", "*", ")", "FROM", "institution", "AS", "T1", "JOIN", "protein", "AS", "T2", "ON", "T1.institution_id", "=", "T2.institution_id", "JOIN", "building", "AS", "T3", "ON", "T3.building_id", "=", "T1.building_id", "WHERE", "T3.floors", ">", "=", "20" ]
[ "select", "count", "(", "*", ")", "from", "institution", "as", "t1", "join", "protein", "as", "t2", "on", "t1", ".", "institution_id", "=", "t2", ".", "institution_id", "join", "building", "as", "t3", "on", "t3", ".", "building_id", "=", "t1", ".", "building_id", "where", "t3", ".", "floors", ">", "=", "value" ]
[ "How", "many", "proteins", "are", "associated", "with", "an", "institution", "in", "a", "building", "with", "at", "least", "20", "floors", "?" ]
protein_institute
[ "CREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);", "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);", "CREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);" ]
How many institutions do not have an associated protein in our record?
SELECT count(*) FROM institution WHERE institution_id NOT IN (SELECT institution_id FROM protein)
[ "SELECT", "count", "(", "*", ")", "FROM", "institution", "WHERE", "institution_id", "NOT", "IN", "(", "SELECT", "institution_id", "FROM", "protein", ")" ]
[ "select", "count", "(", "*", ")", "from", "institution", "where", "institution_id", "not", "in", "(", "select", "institution_id", "from", "protein", ")" ]
[ "How", "many", "institutions", "do", "not", "have", "an", "associated", "protein", "in", "our", "record", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show all the locations where no cinema has capacity over 800.
SELECT LOCATION FROM cinema EXCEPT SELECT LOCATION FROM cinema WHERE capacity > 800
[ "SELECT", "LOCATION", "FROM", "cinema", "EXCEPT", "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "capacity", ">", "800" ]
[ "select", "location", "from", "cinema", "except", "select", "location", "from", "cinema", "where", "capacity", ">", "value" ]
[ "Show", "all", "the", "locations", "where", "no", "cinema", "has", "capacity", "over", "800", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show all the locations where some cinemas were opened in both year 2010 and year 2011.
SELECT LOCATION FROM cinema WHERE openning_year = 2010 INTERSECT SELECT LOCATION FROM cinema WHERE openning_year = 2011
[ "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "openning_year", "=", "2010", "INTERSECT", "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "openning_year", "=", "2011" ]
[ "select", "location", "from", "cinema", "where", "openning_year", "=", "value", "intersect", "select", "location", "from", "cinema", "where", "openning_year", "=", "value" ]
[ "Show", "all", "the", "locations", "where", "some", "cinemas", "were", "opened", "in", "both", "year", "2010", "and", "year", "2011", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
How many cinema do we have?
SELECT count(*) FROM cinema
[ "SELECT", "count", "(", "*", ")", "FROM", "cinema" ]
[ "select", "count", "(", "*", ")", "from", "cinema" ]
[ "How", "many", "cinema", "do", "we", "have", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Count the number of cinemas.
SELECT count(*) FROM cinema
[ "SELECT", "count", "(", "*", ")", "FROM", "cinema" ]
[ "select", "count", "(", "*", ")", "from", "cinema" ]
[ "Count", "the", "number", "of", "cinemas", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show name, opening year, and capacity for each cinema.
SELECT name , openning_year , capacity FROM cinema
[ "SELECT", "name", ",", "openning_year", ",", "capacity", "FROM", "cinema" ]
[ "select", "name", ",", "openning_year", ",", "capacity", "from", "cinema" ]
[ "Show", "name", ",", "opening", "year", ",", "and", "capacity", "for", "each", "cinema", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show the cinema name and location for cinemas with capacity above average.
SELECT name , LOCATION FROM cinema WHERE capacity > (SELECT avg(capacity) FROM cinema)
[ "SELECT", "name", ",", "LOCATION", "FROM", "cinema", "WHERE", "capacity", ">", "(", "SELECT", "avg", "(", "capacity", ")", "FROM", "cinema", ")" ]
[ "select", "name", ",", "location", "from", "cinema", "where", "capacity", ">", "(", "select", "avg", "(", "capacity", ")", "from", "cinema", ")" ]
[ "Show", "the", "cinema", "name", "and", "location", "for", "cinemas", "with", "capacity", "above", "average", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What are all the locations with a cinema?
SELECT DISTINCT LOCATION FROM cinema
[ "SELECT", "DISTINCT", "LOCATION", "FROM", "cinema" ]
[ "select", "distinct", "location", "from", "cinema" ]
[ "What", "are", "all", "the", "locations", "with", "a", "cinema", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Find the distinct locations that has a cinema.
SELECT DISTINCT LOCATION FROM cinema
[ "SELECT", "DISTINCT", "LOCATION", "FROM", "cinema" ]
[ "select", "distinct", "location", "from", "cinema" ]
[ "Find", "the", "distinct", "locations", "that", "has", "a", "cinema", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show all the cinema names and opening years in descending order of opening year.
SELECT name , openning_year FROM cinema ORDER BY openning_year DESC
[ "SELECT", "name", ",", "openning_year", "FROM", "cinema", "ORDER", "BY", "openning_year", "DESC" ]
[ "select", "name", ",", "openning_year", "from", "cinema", "order", "by", "openning_year", "desc" ]
[ "Show", "all", "the", "cinema", "names", "and", "opening", "years", "in", "descending", "order", "of", "opening", "year", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What are the name and location of the cinema with the largest capacity?
SELECT name , LOCATION FROM cinema ORDER BY capacity DESC LIMIT 1
[ "SELECT", "name", ",", "LOCATION", "FROM", "cinema", "ORDER", "BY", "capacity", "DESC", "LIMIT", "1" ]
[ "select", "name", ",", "location", "from", "cinema", "order", "by", "capacity", "desc", "limit", "value" ]
[ "What", "are", "the", "name", "and", "location", "of", "the", "cinema", "with", "the", "largest", "capacity", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show the average, minimum, and maximum capacity for all the cinemas opened in year 2011 or later.
SELECT avg(capacity) , min(capacity) , max(capacity) FROM cinema WHERE openning_year >= 2011
[ "SELECT", "avg", "(", "capacity", ")", ",", "min", "(", "capacity", ")", ",", "max", "(", "capacity", ")", "FROM", "cinema", "WHERE", "openning_year", ">", "=", "2011" ]
[ "select", "avg", "(", "capacity", ")", ",", "min", "(", "capacity", ")", ",", "max", "(", "capacity", ")", "from", "cinema", "where", "openning_year", ">", "=", "value" ]
[ "Show", "the", "average", ",", "minimum", ",", "and", "maximum", "capacity", "for", "all", "the", "cinemas", "opened", "in", "year", "2011", "or", "later", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show each location and the number of cinemas there.
SELECT LOCATION , count(*) FROM cinema GROUP BY LOCATION
[ "SELECT", "LOCATION", ",", "count", "(", "*", ")", "FROM", "cinema", "GROUP", "BY", "LOCATION" ]
[ "select", "location", ",", "count", "(", "*", ")", "from", "cinema", "group", "by", "location" ]
[ "Show", "each", "location", "and", "the", "number", "of", "cinemas", "there", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What is the location with the most cinemas opened in year 2010 or later?
SELECT LOCATION FROM cinema WHERE openning_year >= 2010 GROUP BY LOCATION ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "openning_year", ">", "=", "2010", "GROUP", "BY", "LOCATION", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "location", "from", "cinema", "where", "openning_year", ">", "=", "value", "group", "by", "location", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "What", "is", "the", "location", "with", "the", "most", "cinemas", "opened", "in", "year", "2010", "or", "later", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show all the locations with at least two cinemas with capacity above 300.
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) >= 2
[ "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "capacity", ">", "300", "GROUP", "BY", "LOCATION", "HAVING", "count", "(", "*", ")", ">", "=", "2" ]
[ "select", "location", "from", "cinema", "where", "capacity", ">", "value", "group", "by", "location", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "Show", "all", "the", "locations", "with", "at", "least", "two", "cinemas", "with", "capacity", "above", "300", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Which locations have 2 or more cinemas with capacity over 300?
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) >= 2
[ "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "capacity", ">", "300", "GROUP", "BY", "LOCATION", "HAVING", "count", "(", "*", ")", ">", "=", "2" ]
[ "select", "location", "from", "cinema", "where", "capacity", ">", "value", "group", "by", "location", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "Which", "locations", "have", "2", "or", "more", "cinemas", "with", "capacity", "over", "300", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show the title and director for all films.
SELECT title , directed_by FROM film
[ "SELECT", "title", ",", "directed_by", "FROM", "film" ]
[ "select", "title", ",", "directed_by", "from", "film" ]
[ "Show", "the", "title", "and", "director", "for", "all", "films", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What are the title and director of each film?
SELECT title , directed_by FROM film
[ "SELECT", "title", ",", "directed_by", "FROM", "film" ]
[ "select", "title", ",", "directed_by", "from", "film" ]
[ "What", "are", "the", "title", "and", "director", "of", "each", "film", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show all directors.
SELECT DISTINCT directed_by FROM film
[ "SELECT", "DISTINCT", "directed_by", "FROM", "film" ]
[ "select", "distinct", "directed_by", "from", "film" ]
[ "Show", "all", "directors", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Who are all the directors?
SELECT DISTINCT directed_by FROM film
[ "SELECT", "DISTINCT", "directed_by", "FROM", "film" ]
[ "select", "distinct", "directed_by", "from", "film" ]
[ "Who", "are", "all", "the", "directors", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
List all directors along with the number of films directed by each director.
SELECT directed_by , count(*) FROM film GROUP BY directed_by
[ "SELECT", "directed_by", ",", "count", "(", "*", ")", "FROM", "film", "GROUP", "BY", "directed_by" ]
[ "select", "directed_by", ",", "count", "(", "*", ")", "from", "film", "group", "by", "directed_by" ]
[ "List", "all", "directors", "along", "with", "the", "number", "of", "films", "directed", "by", "each", "director", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What is total number of show times per dat for each cinema?
SELECT T2.name , sum(T1.show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.cinema_id = T2.cinema_id GROUP BY T1.cinema_id
[ "SELECT", "T2.name", ",", "sum", "(", "T1.show_times_per_day", ")", "FROM", "schedule", "AS", "T1", "JOIN", "cinema", "AS", "T2", "ON", "T1.cinema_id", "=", "T2.cinema_id", "GROUP", "BY", "T1.cinema_id" ]
[ "select", "t2", ".", "name", ",", "sum", "(", "t1", ".", "show_times_per_day", ")", "from", "schedule", "as", "t1", "join", "cinema", "as", "t2", "on", "t1", ".", "cinema_id", "=", "t2", ".", "cinema_id", "group", "by", "t1", ".", "cinema_id" ]
[ "What", "is", "total", "number", "of", "show", "times", "per", "dat", "for", "each", "cinema", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What are the title and maximum price of each film?
SELECT T2.title , max(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id
[ "SELECT", "T2.title", ",", "max", "(", "T1.price", ")", "FROM", "schedule", "AS", "T1", "JOIN", "film", "AS", "T2", "ON", "T1.film_id", "=", "T2.film_id", "GROUP", "BY", "T1.film_id" ]
[ "select", "t2", ".", "title", ",", "max", "(", "t1", ".", "price", ")", "from", "schedule", "as", "t1", "join", "film", "as", "t2", "on", "t1", ".", "film_id", "=", "t2", ".", "film_id", "group", "by", "t1", ".", "film_id" ]
[ "What", "are", "the", "title", "and", "maximum", "price", "of", "each", "film", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Give me the title and highest price for each film.
SELECT T2.title , max(T1.price) FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id
[ "SELECT", "T2.title", ",", "max", "(", "T1.price", ")", "FROM", "schedule", "AS", "T1", "JOIN", "film", "AS", "T2", "ON", "T1.film_id", "=", "T2.film_id", "GROUP", "BY", "T1.film_id" ]
[ "select", "t2", ".", "title", ",", "max", "(", "t1", ".", "price", ")", "from", "schedule", "as", "t1", "join", "film", "as", "t2", "on", "t1", ".", "film_id", "=", "t2", ".", "film_id", "group", "by", "t1", ".", "film_id" ]
[ "Give", "me", "the", "title", "and", "highest", "price", "for", "each", "film", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show cinema name, film title, date, and price for each record in schedule.
SELECT T3.name , T2.title , T1.date , T1.price FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN cinema AS T3 ON T1.cinema_id = T3.cinema_id
[ "SELECT", "T3.name", ",", "T2.title", ",", "T1.date", ",", "T1.price", "FROM", "schedule", "AS", "T1", "JOIN", "film", "AS", "T2", "ON", "T1.film_id", "=", "T2.film_id", "JOIN", "cinema", "AS", "T3", "ON", "T1.cinema_id", "=", "T3.cinema_id" ]
[ "select", "t3", ".", "name", ",", "t2", ".", "title", ",", "t1", ".", "date", ",", "t1", ".", "price", "from", "schedule", "as", "t1", "join", "film", "as", "t2", "on", "t1", ".", "film_id", "=", "t2", ".", "film_id", "join", "cinema", "as", "t3", "on", "t1", ".", "cinema_id", "=", "t3", ".", "cinema_id" ]
[ "Show", "cinema", "name", ",", "film", "title", ",", "date", ",", "and", "price", "for", "each", "record", "in", "schedule", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
What are the title and director of the films without any schedule?
SELECT title , directed_by FROM film WHERE film_id NOT IN (SELECT film_id FROM schedule)
[ "SELECT", "title", ",", "directed_by", "FROM", "film", "WHERE", "film_id", "NOT", "IN", "(", "SELECT", "film_id", "FROM", "schedule", ")" ]
[ "select", "title", ",", "directed_by", "from", "film", "where", "film_id", "not", "in", "(", "select", "film_id", "from", "schedule", ")" ]
[ "What", "are", "the", "title", "and", "director", "of", "the", "films", "without", "any", "schedule", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Show director with the largest number of show times in total.
SELECT T2.directed_by FROM schedule AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.directed_by ORDER BY sum(T1.show_times_per_day) DESC LIMIT 1
[ "SELECT", "T2.directed_by", "FROM", "schedule", "AS", "T1", "JOIN", "film", "AS", "T2", "ON", "T1.film_id", "=", "T2.film_id", "GROUP", "BY", "T2.directed_by", "ORDER", "BY", "sum", "(", "T1.show_times_per_day", ")", "DESC", "LIMIT", "1" ]
[ "select", "t2", ".", "directed_by", "from", "schedule", "as", "t1", "join", "film", "as", "t2", "on", "t1", ".", "film_id", "=", "t2", ".", "film_id", "group", "by", "t2", ".", "directed_by", "order", "by", "sum", "(", "t1", ".", "show_times_per_day", ")", "desc", "limit", "value" ]
[ "Show", "director", "with", "the", "largest", "number", "of", "show", "times", "in", "total", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Find the locations that have more than one movie theater with capacity above 300.
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) > 1
[ "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "capacity", ">", "300", "GROUP", "BY", "LOCATION", "HAVING", "count", "(", "*", ")", ">", "1" ]
[ "select", "location", "from", "cinema", "where", "capacity", ">", "value", "group", "by", "location", "having", "count", "(", "*", ")", ">", "value" ]
[ "Find", "the", "locations", "that", "have", "more", "than", "one", "movie", "theater", "with", "capacity", "above", "300", "." ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
In which locations are there more than one movie theater with capacity above 300?
SELECT LOCATION FROM cinema WHERE capacity > 300 GROUP BY LOCATION HAVING count(*) > 1
[ "SELECT", "LOCATION", "FROM", "cinema", "WHERE", "capacity", ">", "300", "GROUP", "BY", "LOCATION", "HAVING", "count", "(", "*", ")", ">", "1" ]
[ "select", "location", "from", "cinema", "where", "capacity", ">", "value", "group", "by", "location", "having", "count", "(", "*", ")", ">", "value" ]
[ "In", "which", "locations", "are", "there", "more", "than", "one", "movie", "theater", "with", "capacity", "above", "300", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
How many films have the word 'Dummy' in their titles?
SELECT count(*) FROM film WHERE title LIKE "%Dummy%"
[ "SELECT", "count", "(", "*", ")", "FROM", "film", "WHERE", "title", "LIKE", "``", "%", "Dummy", "%", "''" ]
[ "select", "count", "(", "*", ")", "from", "film", "where", "title", "like", "value" ]
[ "How", "many", "films", "have", "the", "word", "'Dummy", "'", "in", "their", "titles", "?" ]
cinema
[ "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);", "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));", "CREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);" ]
Count the number of films whose title contains the word 'Dummy'.
SELECT count(*) FROM film WHERE title LIKE "%Dummy%"
[ "SELECT", "count", "(", "*", ")", "FROM", "film", "WHERE", "title", "LIKE", "``", "%", "Dummy", "%", "''" ]
[ "select", "count", "(", "*", ")", "from", "film", "where", "title", "like", "value" ]
[ "Count", "the", "number", "of", "films", "whose", "title", "contains", "the", "word", "'Dummy", "'", "." ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
Are the customers holding coupons with amount 500 bad or good?
SELECT T1.good_or_bad_customer FROM customers AS T1 JOIN discount_coupons AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.coupon_amount = 500
[ "SELECT", "T1.good_or_bad_customer", "FROM", "customers", "AS", "T1", "JOIN", "discount_coupons", "AS", "T2", "ON", "T1.coupon_id", "=", "T2.coupon_id", "WHERE", "T2.coupon_amount", "=", "500" ]
[ "select", "t1", ".", "good_or_bad_customer", "from", "customers", "as", "t1", "join", "discount_coupons", "as", "t2", "on", "t1", ".", "coupon_id", "=", "t2", ".", "coupon_id", "where", "t2", ".", "coupon_amount", "=", "value" ]
[ "Are", "the", "customers", "holding", "coupons", "with", "amount", "500", "bad", "or", "good", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
How many bookings did each customer make? List the customer id, first name, and the count.
SELECT T1.customer_id , T1.first_name , count(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
[ "SELECT", "T1.customer_id", ",", "T1.first_name", ",", "count", "(", "*", ")", "FROM", "Customers", "AS", "T1", "JOIN", "bookings", "AS", "T2", "ON", "T1.customer_id", "=", "T2.customer_id", "GROUP", "BY", "T1.customer_id" ]
[ "select", "t1", ".", "customer_id", ",", "t1", ".", "first_name", ",", "count", "(", "*", ")", "from", "customers", "as", "t1", "join", "bookings", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "group", "by", "t1", ".", "customer_id" ]
[ "How", "many", "bookings", "did", "each", "customer", "make", "?", "List", "the", "customer", "id", ",", "first", "name", ",", "and", "the", "count", "." ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What is the maximum total amount paid by a customer? List the customer id and amount.
SELECT customer_id , sum(amount_paid) FROM Payments GROUP BY customer_id ORDER BY sum(amount_paid) DESC LIMIT 1
[ "SELECT", "customer_id", ",", "sum", "(", "amount_paid", ")", "FROM", "Payments", "GROUP", "BY", "customer_id", "ORDER", "BY", "sum", "(", "amount_paid", ")", "DESC", "LIMIT", "1" ]
[ "select", "customer_id", ",", "sum", "(", "amount_paid", ")", "from", "payments", "group", "by", "customer_id", "order", "by", "sum", "(", "amount_paid", ")", "desc", "limit", "value" ]
[ "What", "is", "the", "maximum", "total", "amount", "paid", "by", "a", "customer", "?", "List", "the", "customer", "id", "and", "amount", "." ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the id and the amount of refund of the booking that incurred the most times of payments?
SELECT T1.booking_id , T1.amount_of_refund FROM Bookings AS T1 JOIN Payments AS T2 ON T1.booking_id = T2.booking_id GROUP BY T1.booking_id ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "T1.booking_id", ",", "T1.amount_of_refund", "FROM", "Bookings", "AS", "T1", "JOIN", "Payments", "AS", "T2", "ON", "T1.booking_id", "=", "T2.booking_id", "GROUP", "BY", "T1.booking_id", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "t1", ".", "booking_id", ",", "t1", ".", "amount_of_refund", "from", "bookings", "as", "t1", "join", "payments", "as", "t2", "on", "t1", ".", "booking_id", "=", "t2", ".", "booking_id", "group", "by", "t1", ".", "booking_id", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "What", "are", "the", "id", "and", "the", "amount", "of", "refund", "of", "the", "booking", "that", "incurred", "the", "most", "times", "of", "payments", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What is the id of the product that is booked for 3 times?
SELECT product_id FROM products_booked GROUP BY product_id HAVING count(*) = 3
[ "SELECT", "product_id", "FROM", "products_booked", "GROUP", "BY", "product_id", "HAVING", "count", "(", "*", ")", "=", "3" ]
[ "select", "product_id", "from", "products_booked", "group", "by", "product_id", "having", "count", "(", "*", ")", "=", "value" ]
[ "What", "is", "the", "id", "of", "the", "product", "that", "is", "booked", "for", "3", "times", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What is the product description of the product booked with an amount of 102.76?
SELECT T2.product_description FROM products_booked AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.booked_amount = 102.76
[ "SELECT", "T2.product_description", "FROM", "products_booked", "AS", "T1", "JOIN", "products_for_hire", "AS", "T2", "ON", "T1.product_id", "=", "T2.product_id", "WHERE", "T1.booked_amount", "=", "102.76" ]
[ "select", "t2", ".", "product_description", "from", "products_booked", "as", "t1", "join", "products_for_hire", "as", "t2", "on", "t1", ".", "product_id", "=", "t2", ".", "product_id", "where", "t1", ".", "booked_amount", "=", "value" ]
[ "What", "is", "the", "product", "description", "of", "the", "product", "booked", "with", "an", "amount", "of", "102.76", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the start date and end date of the booking that has booked the product named 'Book collection A'?
SELECT T3.booking_start_date , T3.booking_end_date FROM Products_for_hire AS T1 JOIN products_booked AS T2 ON T1.product_id = T2.product_id JOIN bookings AS T3 ON T2.booking_id = T3.booking_id WHERE T1.product_name = 'Book collection A'
[ "SELECT", "T3.booking_start_date", ",", "T3.booking_end_date", "FROM", "Products_for_hire", "AS", "T1", "JOIN", "products_booked", "AS", "T2", "ON", "T1.product_id", "=", "T2.product_id", "JOIN", "bookings", "AS", "T3", "ON", "T2.booking_id", "=", "T3.booking_id", "WHERE", "T1.product_name", "=", "'Book", "collection", "A", "'" ]
[ "select", "t3", ".", "booking_start_date", ",", "t3", ".", "booking_end_date", "from", "products_for_hire", "as", "t1", "join", "products_booked", "as", "t2", "on", "t1", ".", "product_id", "=", "t2", ".", "product_id", "join", "bookings", "as", "t3", "on", "t2", ".", "booking_id", "=", "t3", ".", "booking_id", "where", "t1", ".", "product_name", "=", "value" ]
[ "What", "are", "the", "start", "date", "and", "end", "date", "of", "the", "booking", "that", "has", "booked", "the", "product", "named", "'Book", "collection", "A", "'", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the names of products whose availability equals to 1?
SELECT T2.product_name FROM view_product_availability AS T1 JOIN products_for_hire AS T2 ON T1.product_id = T2.product_id WHERE T1.available_yn = 1
[ "SELECT", "T2.product_name", "FROM", "view_product_availability", "AS", "T1", "JOIN", "products_for_hire", "AS", "T2", "ON", "T1.product_id", "=", "T2.product_id", "WHERE", "T1.available_yn", "=", "1" ]
[ "select", "t2", ".", "product_name", "from", "view_product_availability", "as", "t1", "join", "products_for_hire", "as", "t2", "on", "t1", ".", "product_id", "=", "t2", ".", "product_id", "where", "t1", ".", "available_yn", "=", "value" ]
[ "What", "are", "the", "names", "of", "products", "whose", "availability", "equals", "to", "1", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
How many different product types are there?
SELECT count(DISTINCT product_type_code) FROM products_for_hire
[ "SELECT", "count", "(", "DISTINCT", "product_type_code", ")", "FROM", "products_for_hire" ]
[ "select", "count", "(", "distinct", "product_type_code", ")", "from", "products_for_hire" ]
[ "How", "many", "different", "product", "types", "are", "there", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the first name, last name, and gender of all the good customers? Order by their last name.
SELECT first_name , last_name , gender_mf FROM customers WHERE good_or_bad_customer = 'good' ORDER BY last_name
[ "SELECT", "first_name", ",", "last_name", ",", "gender_mf", "FROM", "customers", "WHERE", "good_or_bad_customer", "=", "'good", "'", "ORDER", "BY", "last_name" ]
[ "select", "first_name", ",", "last_name", ",", "gender_mf", "from", "customers", "where", "good_or_bad_customer", "=", "value", "order", "by", "last_name" ]
[ "What", "are", "the", "first", "name", ",", "last", "name", ",", "and", "gender", "of", "all", "the", "good", "customers", "?", "Order", "by", "their", "last", "name", "." ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What is the average amount due for all the payments?
SELECT avg(amount_due) FROM payments
[ "SELECT", "avg", "(", "amount_due", ")", "FROM", "payments" ]
[ "select", "avg", "(", "amount_due", ")", "from", "payments" ]
[ "What", "is", "the", "average", "amount", "due", "for", "all", "the", "payments", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the maximum, minimum, and average booked count for the products booked?
SELECT max(booked_count) , min(booked_count) , avg(booked_count) FROM products_booked
[ "SELECT", "max", "(", "booked_count", ")", ",", "min", "(", "booked_count", ")", ",", "avg", "(", "booked_count", ")", "FROM", "products_booked" ]
[ "select", "max", "(", "booked_count", ")", ",", "min", "(", "booked_count", ")", ",", "avg", "(", "booked_count", ")", "from", "products_booked" ]
[ "What", "are", "the", "maximum", ",", "minimum", ",", "and", "average", "booked", "count", "for", "the", "products", "booked", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are all the distinct payment types?
SELECT DISTINCT payment_type_code FROM payments
[ "SELECT", "DISTINCT", "payment_type_code", "FROM", "payments" ]
[ "select", "distinct", "payment_type_code", "from", "payments" ]
[ "What", "are", "all", "the", "distinct", "payment", "types", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the daily hire costs for the products with substring 'Book' in its name?
SELECT daily_hire_cost FROM Products_for_hire WHERE product_name LIKE '%Book%'
[ "SELECT", "daily_hire_cost", "FROM", "Products_for_hire", "WHERE", "product_name", "LIKE", "'", "%", "Book", "%", "'" ]
[ "select", "daily_hire_cost", "from", "products_for_hire", "where", "product_name", "like", "value" ]
[ "What", "are", "the", "daily", "hire", "costs", "for", "the", "products", "with", "substring", "'Book", "'", "in", "its", "name", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
How many products are never booked with amount higher than 200?
SELECT count(*) FROM Products_for_hire WHERE product_id NOT IN ( SELECT product_id FROM products_booked WHERE booked_amount > 200 )
[ "SELECT", "count", "(", "*", ")", "FROM", "Products_for_hire", "WHERE", "product_id", "NOT", "IN", "(", "SELECT", "product_id", "FROM", "products_booked", "WHERE", "booked_amount", ">", "200", ")" ]
[ "select", "count", "(", "*", ")", "from", "products_for_hire", "where", "product_id", "not", "in", "(", "select", "product_id", "from", "products_booked", "where", "booked_amount", ">", "value", ")" ]
[ "How", "many", "products", "are", "never", "booked", "with", "amount", "higher", "than", "200", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the coupon amount of the coupons owned by both good and bad customers?
SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'good' INTERSECT SELECT T1.coupon_amount FROM Discount_Coupons AS T1 JOIN customers AS T2 ON T1.coupon_id = T2.coupon_id WHERE T2.good_or_bad_customer = 'bad'
[ "SELECT", "T1.coupon_amount", "FROM", "Discount_Coupons", "AS", "T1", "JOIN", "customers", "AS", "T2", "ON", "T1.coupon_id", "=", "T2.coupon_id", "WHERE", "T2.good_or_bad_customer", "=", "'good", "'", "INTERSECT", "SELECT", "T1.coupon_amount", "FROM", "Discount_Coupons", "AS", "T1", "JOIN", "customers", "AS", "T2", "ON", "T1.coupon_id", "=", "T2.coupon_id", "WHERE", "T2.good_or_bad_customer", "=", "'bad", "'" ]
[ "select", "t1", ".", "coupon_amount", "from", "discount_coupons", "as", "t1", "join", "customers", "as", "t2", "on", "t1", ".", "coupon_id", "=", "t2", ".", "coupon_id", "where", "t2", ".", "good_or_bad_customer", "=", "value", "intersect", "select", "t1", ".", "coupon_amount", "from", "discount_coupons", "as", "t1", "join", "customers", "as", "t2", "on", "t1", ".", "coupon_id", "=", "t2", ".", "coupon_id", "where", "t2", ".", "good_or_bad_customer", "=", "value" ]
[ "What", "are", "the", "coupon", "amount", "of", "the", "coupons", "owned", "by", "both", "good", "and", "bad", "customers", "?" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check'
SELECT payment_date FROM payments WHERE amount_paid > 300 OR payment_type_code = 'Check'
[ "SELECT", "payment_date", "FROM", "payments", "WHERE", "amount_paid", ">", "300", "OR", "payment_type_code", "=", "'Check", "'" ]
[ "select", "payment_date", "from", "payments", "where", "amount_paid", ">", "value", "or", "payment_type_code", "=", "value" ]
[ "What", "are", "the", "payment", "date", "of", "the", "payment", "with", "amount", "paid", "higher", "than", "300", "or", "with", "payment", "type", "is", "'Check", "'" ]
products_for_hire
[ "CREATE TABLE `Discount_Coupons` (\n`coupon_id` INTEGER PRIMARY KEY,\n`date_issued` DATETIME,\n`coupon_amount` DECIMAL(19,4)\n);", "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`coupon_id` INTEGER NOT NULL,\n`good_or_bad_customer` VARCHAR(4),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`date_became_customer` DATETIME,\n`date_last_hire` DATETIME,\nFOREIGN KEY (`coupon_id` ) REFERENCES `Discount_Coupons`(`coupon_id` )\n);", "CREATE TABLE `Bookings` (\n`booking_id` INTEGER PRIMARY KEY ,\n`customer_id` INTEGER NOT NULL,\n`booking_status_code` VARCHAR(10) NOT NULL,\n`returned_damaged_yn` VARCHAR(40),\n`booking_start_date` DATETIME,\n`booking_end_date` DATETIME,\n`count_hired` VARCHAR(40),\n`amount_payable` DECIMAL(19,4),\n`amount_of_discount` DECIMAL(19,4),\n`amount_outstanding` DECIMAL(19,4),\n`amount_of_refund` DECIMAL(19,4),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_for_Hire` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15) NOT NULL,\n`daily_hire_cost` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255)\n);", "CREATE TABLE `Payments` (\n`payment_id` INTEGER PRIMARY KEY,\n`booking_id` INTEGER,\n`customer_id` INTEGER NOT NULL,\n`payment_type_code` VARCHAR(15) NOT NULL,\n`amount_paid_in_full_yn` VARCHAR(1),\n`payment_date` DATETIME,\n`amount_due` DECIMAL(19,4),\n`amount_paid` DECIMAL(19,4),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products_Booked` (\n`booking_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`returned_yn` VARCHAR(1),\n`returned_late_yn` VARCHAR(1),\n`booked_count` INTEGER,\n`booked_amount` FLOAT NULL,\nPRIMARY KEY (`booking_id`, `product_id`)\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);", "CREATE TABLE `View_Product_Availability` (\n`product_id` INTEGER NOT NULL,\n`booking_id` INTEGER NOT NULL,\n`status_date` DATETIME PRIMARY KEY,\n`available_yn` VARCHAR(1),\nFOREIGN KEY (`booking_id` ) REFERENCES `Bookings`(`booking_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products_for_Hire`(`product_id` )\n);" ]
What are the names and descriptions of the products that are of 'Cutlery' type and have daily hire cost lower than 20?
SELECT product_name , product_description FROM products_for_hire WHERE product_type_code = 'Cutlery' AND daily_hire_cost < 20
[ "SELECT", "product_name", ",", "product_description", "FROM", "products_for_hire", "WHERE", "product_type_code", "=", "'Cutlery", "'", "AND", "daily_hire_cost", "<", "20" ]
[ "select", "product_name", ",", "product_description", "from", "products_for_hire", "where", "product_type_code", "=", "value", "and", "daily_hire_cost", "<", "value" ]
[ "What", "are", "the", "names", "and", "descriptions", "of", "the", "products", "that", "are", "of", "'Cutlery", "'", "type", "and", "have", "daily", "hire", "cost", "lower", "than", "20", "?" ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
How many phones are there?
SELECT count(*) FROM phone
[ "SELECT", "count", "(", "*", ")", "FROM", "phone" ]
[ "select", "count", "(", "*", ")", "from", "phone" ]
[ "How", "many", "phones", "are", "there", "?" ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
List the names of phones in ascending order of price.
SELECT Name FROM phone ORDER BY Price ASC
[ "SELECT", "Name", "FROM", "phone", "ORDER", "BY", "Price", "ASC" ]
[ "select", "name", "from", "phone", "order", "by", "price", "asc" ]
[ "List", "the", "names", "of", "phones", "in", "ascending", "order", "of", "price", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
What are the memories and carriers of phones?
SELECT Memory_in_G , Carrier FROM phone
[ "SELECT", "Memory_in_G", ",", "Carrier", "FROM", "phone" ]
[ "select", "memory_in_g", ",", "carrier", "from", "phone" ]
[ "What", "are", "the", "memories", "and", "carriers", "of", "phones", "?" ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
List the distinct carriers of phones with memories bigger than 32.
SELECT DISTINCT Carrier FROM phone WHERE Memory_in_G > 32
[ "SELECT", "DISTINCT", "Carrier", "FROM", "phone", "WHERE", "Memory_in_G", ">", "32" ]
[ "select", "distinct", "carrier", "from", "phone", "where", "memory_in_g", ">", "value" ]
[ "List", "the", "distinct", "carriers", "of", "phones", "with", "memories", "bigger", "than", "32", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the names of phones with carrier either "Sprint" or "TMobile".
SELECT Name FROM phone WHERE Carrier = "Sprint" OR Carrier = "TMobile"
[ "SELECT", "Name", "FROM", "phone", "WHERE", "Carrier", "=", "``", "Sprint", "''", "OR", "Carrier", "=", "``", "TMobile", "''" ]
[ "select", "name", "from", "phone", "where", "carrier", "=", "value", "or", "carrier", "=", "value" ]
[ "Show", "the", "names", "of", "phones", "with", "carrier", "either", "``", "Sprint", "''", "or", "``", "TMobile", "''", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
What is the carrier of the most expensive phone?
SELECT Carrier FROM phone ORDER BY Price DESC LIMIT 1
[ "SELECT", "Carrier", "FROM", "phone", "ORDER", "BY", "Price", "DESC", "LIMIT", "1" ]
[ "select", "carrier", "from", "phone", "order", "by", "price", "desc", "limit", "value" ]
[ "What", "is", "the", "carrier", "of", "the", "most", "expensive", "phone", "?" ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show different carriers of phones together with the number of phones with each carrier.
SELECT Carrier , COUNT(*) FROM phone GROUP BY Carrier
[ "SELECT", "Carrier", ",", "COUNT", "(", "*", ")", "FROM", "phone", "GROUP", "BY", "Carrier" ]
[ "select", "carrier", ",", "count", "(", "*", ")", "from", "phone", "group", "by", "carrier" ]
[ "Show", "different", "carriers", "of", "phones", "together", "with", "the", "number", "of", "phones", "with", "each", "carrier", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the most frequently used carrier of the phones.
SELECT Carrier FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC LIMIT 1
[ "SELECT", "Carrier", "FROM", "phone", "GROUP", "BY", "Carrier", "ORDER", "BY", "COUNT", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "carrier", "from", "phone", "group", "by", "carrier", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Show", "the", "most", "frequently", "used", "carrier", "of", "the", "phones", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the carriers that have both phones with memory smaller than 32 and phones with memory bigger than 64.
SELECT Carrier FROM phone WHERE Memory_in_G < 32 INTERSECT SELECT Carrier FROM phone WHERE Memory_in_G > 64
[ "SELECT", "Carrier", "FROM", "phone", "WHERE", "Memory_in_G", "<", "32", "INTERSECT", "SELECT", "Carrier", "FROM", "phone", "WHERE", "Memory_in_G", ">", "64" ]
[ "select", "carrier", "from", "phone", "where", "memory_in_g", "<", "value", "intersect", "select", "carrier", "from", "phone", "where", "memory_in_g", ">", "value" ]
[ "Show", "the", "carriers", "that", "have", "both", "phones", "with", "memory", "smaller", "than", "32", "and", "phones", "with", "memory", "bigger", "than", "64", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the names of phones and the districts of markets they are on.
SELECT T3.Name , T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID
[ "SELECT", "T3.Name", ",", "T2.District", "FROM", "phone_market", "AS", "T1", "JOIN", "market", "AS", "T2", "ON", "T1.Market_ID", "=", "T2.Market_ID", "JOIN", "phone", "AS", "T3", "ON", "T1.Phone_ID", "=", "T3.Phone_ID" ]
[ "select", "t3", ".", "name", ",", "t2", ".", "district", "from", "phone_market", "as", "t1", "join", "market", "as", "t2", "on", "t1", ".", "market_id", "=", "t2", ".", "market_id", "join", "phone", "as", "t3", "on", "t1", ".", "phone_id", "=", "t3", ".", "phone_id" ]
[ "Show", "the", "names", "of", "phones", "and", "the", "districts", "of", "markets", "they", "are", "on", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the names of phones and the districts of markets they are on, in ascending order of the ranking of the market.
SELECT T3.Name , T2.District FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID ORDER BY T2.Ranking
[ "SELECT", "T3.Name", ",", "T2.District", "FROM", "phone_market", "AS", "T1", "JOIN", "market", "AS", "T2", "ON", "T1.Market_ID", "=", "T2.Market_ID", "JOIN", "phone", "AS", "T3", "ON", "T1.Phone_ID", "=", "T3.Phone_ID", "ORDER", "BY", "T2.Ranking" ]
[ "select", "t3", ".", "name", ",", "t2", ".", "district", "from", "phone_market", "as", "t1", "join", "market", "as", "t2", "on", "t1", ".", "market_id", "=", "t2", ".", "market_id", "join", "phone", "as", "t3", "on", "t1", ".", "phone_id", "=", "t3", ".", "phone_id", "order", "by", "t2", ".", "ranking" ]
[ "Show", "the", "names", "of", "phones", "and", "the", "districts", "of", "markets", "they", "are", "on", ",", "in", "ascending", "order", "of", "the", "ranking", "of", "the", "market", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the names of phones that are on market with number of shops greater than 50.
SELECT T3.Name FROM phone_market AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID JOIN phone AS T3 ON T1.Phone_ID = T3.Phone_ID WHERE T2.Num_of_shops > 50
[ "SELECT", "T3.Name", "FROM", "phone_market", "AS", "T1", "JOIN", "market", "AS", "T2", "ON", "T1.Market_ID", "=", "T2.Market_ID", "JOIN", "phone", "AS", "T3", "ON", "T1.Phone_ID", "=", "T3.Phone_ID", "WHERE", "T2.Num_of_shops", ">", "50" ]
[ "select", "t3", ".", "name", "from", "phone_market", "as", "t1", "join", "market", "as", "t2", "on", "t1", ".", "market_id", "=", "t2", ".", "market_id", "join", "phone", "as", "t3", "on", "t1", ".", "phone_id", "=", "t3", ".", "phone_id", "where", "t2", ".", "num_of_shops", ">", "value" ]
[ "Show", "the", "names", "of", "phones", "that", "are", "on", "market", "with", "number", "of", "shops", "greater", "than", "50", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
For each phone, show its names and total number of stocks.
SELECT T2.Name , sum(T1.Num_of_stock) FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name
[ "SELECT", "T2.Name", ",", "sum", "(", "T1.Num_of_stock", ")", "FROM", "phone_market", "AS", "T1", "JOIN", "phone", "AS", "T2", "ON", "T1.Phone_ID", "=", "T2.Phone_ID", "GROUP", "BY", "T2.Name" ]
[ "select", "t2", ".", "name", ",", "sum", "(", "t1", ".", "num_of_stock", ")", "from", "phone_market", "as", "t1", "join", "phone", "as", "t2", "on", "t1", ".", "phone_id", "=", "t2", ".", "phone_id", "group", "by", "t2", ".", "name" ]
[ "For", "each", "phone", ",", "show", "its", "names", "and", "total", "number", "of", "stocks", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
Show the names of phones that have total number of stocks bigger than 2000, in descending order of the total number of stocks.
SELECT T2.Name FROM phone_market AS T1 JOIN phone AS T2 ON T1.Phone_ID = T2.Phone_ID GROUP BY T2.Name HAVING sum(T1.Num_of_stock) >= 2000 ORDER BY sum(T1.Num_of_stock) DESC
[ "SELECT", "T2.Name", "FROM", "phone_market", "AS", "T1", "JOIN", "phone", "AS", "T2", "ON", "T1.Phone_ID", "=", "T2.Phone_ID", "GROUP", "BY", "T2.Name", "HAVING", "sum", "(", "T1.Num_of_stock", ")", ">", "=", "2000", "ORDER", "BY", "sum", "(", "T1.Num_of_stock", ")", "DESC" ]
[ "select", "t2", ".", "name", "from", "phone_market", "as", "t1", "join", "phone", "as", "t2", "on", "t1", ".", "phone_id", "=", "t2", ".", "phone_id", "group", "by", "t2", ".", "name", "having", "sum", "(", "t1", ".", "num_of_stock", ")", ">", "=", "value", "order", "by", "sum", "(", "t1", ".", "num_of_stock", ")", "desc" ]
[ "Show", "the", "names", "of", "phones", "that", "have", "total", "number", "of", "stocks", "bigger", "than", "2000", ",", "in", "descending", "order", "of", "the", "total", "number", "of", "stocks", "." ]
phone_market
[ "CREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);", "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);", "CREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);" ]
List the names of phones that are not on any market.
SELECT Name FROM phone WHERE Phone_id NOT IN (SELECT Phone_ID FROM phone_market)
[ "SELECT", "Name", "FROM", "phone", "WHERE", "Phone_id", "NOT", "IN", "(", "SELECT", "Phone_ID", "FROM", "phone_market", ")" ]
[ "select", "name", "from", "phone", "where", "phone_id", "not", "in", "(", "select", "phone_id", "from", "phone_market", ")" ]
[ "List", "the", "names", "of", "phones", "that", "are", "not", "on", "any", "market", "." ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
How many gas companies are there?
SELECT count(*) FROM company
[ "SELECT", "count", "(", "*", ")", "FROM", "company" ]
[ "select", "count", "(", "*", ")", "from", "company" ]
[ "How", "many", "gas", "companies", "are", "there", "?" ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
What is the total number of companies?
SELECT count(*) FROM company
[ "SELECT", "count", "(", "*", ")", "FROM", "company" ]
[ "select", "count", "(", "*", ")", "from", "company" ]
[ "What", "is", "the", "total", "number", "of", "companies", "?" ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
List the company name and rank for all companies in the decreasing order of their sales.
SELECT company , rank FROM company ORDER BY Sales_billion DESC
[ "SELECT", "company", ",", "rank", "FROM", "company", "ORDER", "BY", "Sales_billion", "DESC" ]
[ "select", "company", ",", "rank", "from", "company", "order", "by", "sales_billion", "desc" ]
[ "List", "the", "company", "name", "and", "rank", "for", "all", "companies", "in", "the", "decreasing", "order", "of", "their", "sales", "." ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
What is the name and rank of every company ordered by descending number of sales?
SELECT company , rank FROM company ORDER BY Sales_billion DESC
[ "SELECT", "company", ",", "rank", "FROM", "company", "ORDER", "BY", "Sales_billion", "DESC" ]
[ "select", "company", ",", "rank", "from", "company", "order", "by", "sales_billion", "desc" ]
[ "What", "is", "the", "name", "and", "rank", "of", "every", "company", "ordered", "by", "descending", "number", "of", "sales", "?" ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
Show the company name and the main industry for all companies whose headquarters are not from USA.
SELECT company , main_industry FROM company WHERE headquarters != 'USA'
[ "SELECT", "company", ",", "main_industry", "FROM", "company", "WHERE", "headquarters", "!", "=", "'USA", "'" ]
[ "select", "company", ",", "main_industry", "from", "company", "where", "headquarters", "!", "=", "value" ]
[ "Show", "the", "company", "name", "and", "the", "main", "industry", "for", "all", "companies", "whose", "headquarters", "are", "not", "from", "USA", "." ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
What are the companies and main industries of all companies that are not headquartered in the United States?
SELECT company , main_industry FROM company WHERE headquarters != 'USA'
[ "SELECT", "company", ",", "main_industry", "FROM", "company", "WHERE", "headquarters", "!", "=", "'USA", "'" ]
[ "select", "company", ",", "main_industry", "from", "company", "where", "headquarters", "!", "=", "value" ]
[ "What", "are", "the", "companies", "and", "main", "industries", "of", "all", "companies", "that", "are", "not", "headquartered", "in", "the", "United", "States", "?" ]
gas_company
[ "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);", "CREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);", "CREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);" ]
Show all company names and headquarters in the descending order of market value.
SELECT company , headquarters FROM company ORDER BY market_value DESC
[ "SELECT", "company", ",", "headquarters", "FROM", "company", "ORDER", "BY", "market_value", "DESC" ]
[ "select", "company", ",", "headquarters", "from", "company", "order", "by", "market_value", "desc" ]
[ "Show", "all", "company", "names", "and", "headquarters", "in", "the", "descending", "order", "of", "market", "value", "." ]