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 |
|---|---|---|---|---|---|---|
products_gen_characteristics | [
"CREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);",
"CREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);",
"CREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);",
"CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);",
"CREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);"
] | How many colors are never used by any product? | SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products ) | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Ref_colors",
"WHERE",
"color_code",
"NOT",
"IN",
"(",
"SELECT",
"color_code",
"FROM",
"products",
")"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"ref_colors",
"where",
"color_code",
"not",
"in",
"(",
"select",
"color_code",
"from",
"products",
")"
] | [
"How",
"many",
"colors",
"are",
"never",
"used",
"by",
"any",
"product",
"?"
] |
products_gen_characteristics | [
"CREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);",
"CREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);",
"CREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);",
"CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);",
"CREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);"
] | Count the number of colors that are not used in any products. | SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products ) | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"Ref_colors",
"WHERE",
"color_code",
"NOT",
"IN",
"(",
"SELECT",
"color_code",
"FROM",
"products",
")"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"ref_colors",
"where",
"color_code",
"not",
"in",
"(",
"select",
"color_code",
"from",
"products",
")"
] | [
"Count",
"the",
"number",
"of",
"colors",
"that",
"are",
"not",
"used",
"in",
"any",
"products",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | How many events are there? | SELECT count(*) FROM event | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"event"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"event"
] | [
"How",
"many",
"events",
"are",
"there",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | List all the event names by year from the most recent to the oldest. | SELECT name FROM event ORDER BY YEAR DESC | [
"SELECT",
"name",
"FROM",
"event",
"ORDER",
"BY",
"YEAR",
"DESC"
] | [
"select",
"name",
"from",
"event",
"order",
"by",
"year",
"desc"
] | [
"List",
"all",
"the",
"event",
"names",
"by",
"year",
"from",
"the",
"most",
"recent",
"to",
"the",
"oldest",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | What is the name of the event that happened in the most recent year? | SELECT name FROM event ORDER BY YEAR DESC LIMIT 1 | [
"SELECT",
"name",
"FROM",
"event",
"ORDER",
"BY",
"YEAR",
"DESC",
"LIMIT",
"1"
] | [
"select",
"name",
"from",
"event",
"order",
"by",
"year",
"desc",
"limit",
"value"
] | [
"What",
"is",
"the",
"name",
"of",
"the",
"event",
"that",
"happened",
"in",
"the",
"most",
"recent",
"year",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | How many stadiums are there? | SELECT count(*) FROM stadium | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"stadium"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"stadium"
] | [
"How",
"many",
"stadiums",
"are",
"there",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the name of the stadium that has the maximum capacity. | SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1 | [
"SELECT",
"name",
"FROM",
"stadium",
"ORDER",
"BY",
"capacity",
"DESC",
"LIMIT",
"1"
] | [
"select",
"name",
"from",
"stadium",
"order",
"by",
"capacity",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"name",
"of",
"the",
"stadium",
"that",
"has",
"the",
"maximum",
"capacity",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of stadiums whose capacity is smaller than the average capacity. | SELECT name FROM stadium WHERE capacity < (SELECT avg(capacity) FROM stadium) | [
"SELECT",
"name",
"FROM",
"stadium",
"WHERE",
"capacity",
"<",
"(",
"SELECT",
"avg",
"(",
"capacity",
")",
"FROM",
"stadium",
")"
] | [
"select",
"name",
"from",
"stadium",
"where",
"capacity",
"<",
"(",
"select",
"avg",
"(",
"capacity",
")",
"from",
"stadium",
")"
] | [
"Find",
"the",
"names",
"of",
"stadiums",
"whose",
"capacity",
"is",
"smaller",
"than",
"the",
"average",
"capacity",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the country that has the most stadiums. | SELECT country FROM stadium GROUP BY country ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"country",
"FROM",
"stadium",
"GROUP",
"BY",
"country",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"country",
"from",
"stadium",
"group",
"by",
"country",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"country",
"that",
"has",
"the",
"most",
"stadiums",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Which country has at most 3 stadiums listed? | SELECT country FROM stadium GROUP BY country HAVING count(*) <= 3 | [
"SELECT",
"country",
"FROM",
"stadium",
"GROUP",
"BY",
"country",
"HAVING",
"count",
"(",
"*",
")",
"<",
"=",
"3"
] | [
"select",
"country",
"from",
"stadium",
"group",
"by",
"country",
"having",
"count",
"(",
"*",
")",
"<",
"=",
"value"
] | [
"Which",
"country",
"has",
"at",
"most",
"3",
"stadiums",
"listed",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000? | SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000 | [
"SELECT",
"country",
"FROM",
"stadium",
"WHERE",
"capacity",
">",
"60000",
"INTERSECT",
"SELECT",
"country",
"FROM",
"stadium",
"WHERE",
"capacity",
"<",
"50000"
] | [
"select",
"country",
"from",
"stadium",
"where",
"capacity",
">",
"value",
"intersect",
"select",
"country",
"from",
"stadium",
"where",
"capacity",
"<",
"value"
] | [
"Which",
"country",
"has",
"both",
"stadiums",
"with",
"capacity",
"greater",
"than",
"60000",
"and",
"stadiums",
"with",
"capacity",
"less",
"than",
"50000",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | How many cities have a stadium that was opened before the year of 2006? | SELECT count(DISTINCT city) FROM stadium WHERE opening_year < 2006 | [
"SELECT",
"count",
"(",
"DISTINCT",
"city",
")",
"FROM",
"stadium",
"WHERE",
"opening_year",
"<",
"2006"
] | [
"select",
"count",
"(",
"distinct",
"city",
")",
"from",
"stadium",
"where",
"opening_year",
"<",
"value"
] | [
"How",
"many",
"cities",
"have",
"a",
"stadium",
"that",
"was",
"opened",
"before",
"the",
"year",
"of",
"2006",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | How many stadiums does each country have? | SELECT country , count(*) FROM stadium GROUP BY country | [
"SELECT",
"country",
",",
"count",
"(",
"*",
")",
"FROM",
"stadium",
"GROUP",
"BY",
"country"
] | [
"select",
"country",
",",
"count",
"(",
"*",
")",
"from",
"stadium",
"group",
"by",
"country"
] | [
"How",
"many",
"stadiums",
"does",
"each",
"country",
"have",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Which countries do not have a stadium that was opened after 2006? | SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006 | [
"SELECT",
"country",
"FROM",
"stadium",
"EXCEPT",
"SELECT",
"country",
"FROM",
"stadium",
"WHERE",
"opening_year",
">",
"2006"
] | [
"select",
"country",
"from",
"stadium",
"except",
"select",
"country",
"from",
"stadium",
"where",
"opening_year",
">",
"value"
] | [
"Which",
"countries",
"do",
"not",
"have",
"a",
"stadium",
"that",
"was",
"opened",
"after",
"2006",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | How many stadiums are not in country "Russia"? | SELECT count(*) FROM stadium WHERE country != 'Russia' | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"stadium",
"WHERE",
"country",
"!",
"=",
"'Russia",
"'"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"stadium",
"where",
"country",
"!",
"=",
"value"
] | [
"How",
"many",
"stadiums",
"are",
"not",
"in",
"country",
"``",
"Russia",
"''",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of all swimmers, sorted by their 100 meter scores in ascending order. | SELECT name FROM swimmer ORDER BY meter_100 | [
"SELECT",
"name",
"FROM",
"swimmer",
"ORDER",
"BY",
"meter_100"
] | [
"select",
"name",
"from",
"swimmer",
"order",
"by",
"meter_100"
] | [
"Find",
"the",
"names",
"of",
"all",
"swimmers",
",",
"sorted",
"by",
"their",
"100",
"meter",
"scores",
"in",
"ascending",
"order",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | How many different countries are all the swimmers from? | SELECT count(DISTINCT nationality) FROM swimmer | [
"SELECT",
"count",
"(",
"DISTINCT",
"nationality",
")",
"FROM",
"swimmer"
] | [
"select",
"count",
"(",
"distinct",
"nationality",
")",
"from",
"swimmer"
] | [
"How",
"many",
"different",
"countries",
"are",
"all",
"the",
"swimmers",
"from",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | List countries that have more than one swimmer. | SELECT nationality , count(*) FROM swimmer GROUP BY nationality HAVING count(*) > 1 | [
"SELECT",
"nationality",
",",
"count",
"(",
"*",
")",
"FROM",
"swimmer",
"GROUP",
"BY",
"nationality",
"HAVING",
"count",
"(",
"*",
")",
">",
"1"
] | [
"select",
"nationality",
",",
"count",
"(",
"*",
")",
"from",
"swimmer",
"group",
"by",
"nationality",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"List",
"countries",
"that",
"have",
"more",
"than",
"one",
"swimmer",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find all 200 meter and 300 meter results of swimmers with nationality "Australia". | SELECT meter_200 , meter_300 FROM swimmer WHERE nationality = 'Australia' | [
"SELECT",
"meter_200",
",",
"meter_300",
"FROM",
"swimmer",
"WHERE",
"nationality",
"=",
"'Australia",
"'"
] | [
"select",
"meter_200",
",",
"meter_300",
"from",
"swimmer",
"where",
"nationality",
"=",
"value"
] | [
"Find",
"all",
"200",
"meter",
"and",
"300",
"meter",
"results",
"of",
"swimmers",
"with",
"nationality",
"``",
"Australia",
"''",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of swimmers who has a result of "win". | SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' | [
"SELECT",
"t1.name",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"WHERE",
"RESULT",
"=",
"'Win",
"'"
] | [
"select",
"t1",
".",
"name",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"where",
"result",
"=",
"value"
] | [
"Find",
"the",
"names",
"of",
"swimmers",
"who",
"has",
"a",
"result",
"of",
"``",
"win",
"''",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | What is the name of the stadium which held the most events? | SELECT t1.name FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"t1.name",
"FROM",
"stadium",
"AS",
"t1",
"JOIN",
"event",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.stadium_id",
"GROUP",
"BY",
"t2.stadium_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t1",
".",
"name",
"from",
"stadium",
"as",
"t1",
"join",
"event",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"stadium_id",
"group",
"by",
"t2",
".",
"stadium_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"What",
"is",
"the",
"name",
"of",
"the",
"stadium",
"which",
"held",
"the",
"most",
"events",
"?"
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the name and capacity of the stadium where the event named "World Junior" happened. | SELECT t1.name , t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior' | [
"SELECT",
"t1.name",
",",
"t1.capacity",
"FROM",
"stadium",
"AS",
"t1",
"JOIN",
"event",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.stadium_id",
"WHERE",
"t2.name",
"=",
"'World",
"Junior",
"'"
] | [
"select",
"t1",
".",
"name",
",",
"t1",
".",
"capacity",
"from",
"stadium",
"as",
"t1",
"join",
"event",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"stadium_id",
"where",
"t2",
".",
"name",
"=",
"value"
] | [
"Find",
"the",
"name",
"and",
"capacity",
"of",
"the",
"stadium",
"where",
"the",
"event",
"named",
"``",
"World",
"Junior",
"''",
"happened",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of stadiums which have never had any event. | SELECT name FROM stadium WHERE id NOT IN (SELECT stadium_id FROM event) | [
"SELECT",
"name",
"FROM",
"stadium",
"WHERE",
"id",
"NOT",
"IN",
"(",
"SELECT",
"stadium_id",
"FROM",
"event",
")"
] | [
"select",
"name",
"from",
"stadium",
"where",
"id",
"not",
"in",
"(",
"select",
"stadium_id",
"from",
"event",
")"
] | [
"Find",
"the",
"names",
"of",
"stadiums",
"which",
"have",
"never",
"had",
"any",
"event",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the name of the swimmer who has the most records. | SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"t1.name",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"GROUP",
"BY",
"t2.swimmer_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t1",
".",
"name",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"group",
"by",
"t2",
".",
"swimmer_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"name",
"of",
"the",
"swimmer",
"who",
"has",
"the",
"most",
"records",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the name of the swimmer who has at least 2 records. | SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id HAVING count(*) >= 2 | [
"SELECT",
"t1.name",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"GROUP",
"BY",
"t2.swimmer_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2"
] | [
"select",
"t1",
".",
"name",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"group",
"by",
"t2",
".",
"swimmer_id",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] | [
"Find",
"the",
"name",
"of",
"the",
"swimmer",
"who",
"has",
"at",
"least",
"2",
"records",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time. | SELECT t1.name , t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' GROUP BY t2.swimmer_id HAVING count(*) > 1 | [
"SELECT",
"t1.name",
",",
"t1.nationality",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"WHERE",
"RESULT",
"=",
"'Win",
"'",
"GROUP",
"BY",
"t2.swimmer_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"1"
] | [
"select",
"t1",
".",
"name",
",",
"t1",
".",
"nationality",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"where",
"result",
"=",
"value",
"group",
"by",
"t2",
".",
"swimmer_id",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Find",
"the",
"name",
"and",
"nationality",
"of",
"the",
"swimmer",
"who",
"has",
"won",
"(",
"i.e.",
",",
"has",
"a",
"result",
"of",
"``",
"win",
"''",
")",
"more",
"than",
"1",
"time",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of the swimmers who have no record. | SELECT name FROM swimmer WHERE id NOT IN (SELECT swimmer_id FROM record) | [
"SELECT",
"name",
"FROM",
"swimmer",
"WHERE",
"id",
"NOT",
"IN",
"(",
"SELECT",
"swimmer_id",
"FROM",
"record",
")"
] | [
"select",
"name",
"from",
"swimmer",
"where",
"id",
"not",
"in",
"(",
"select",
"swimmer_id",
"from",
"record",
")"
] | [
"Find",
"the",
"names",
"of",
"the",
"swimmers",
"who",
"have",
"no",
"record",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of the swimmers who have both "win" and "loss" results in the record. | SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' INTERSECT SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Loss' | [
"SELECT",
"t1.name",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"WHERE",
"RESULT",
"=",
"'Win",
"'",
"INTERSECT",
"SELECT",
"t1.name",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"WHERE",
"RESULT",
"=",
"'Loss",
"'"
] | [
"select",
"t1",
".",
"name",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"where",
"result",
"=",
"value",
"intersect",
"select",
"t1",
".",
"name",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"where",
"result",
"=",
"value"
] | [
"Find",
"the",
"names",
"of",
"the",
"swimmers",
"who",
"have",
"both",
"``",
"win",
"''",
"and",
"``",
"loss",
"''",
"results",
"in",
"the",
"record",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of stadiums that some Australian swimmers have been to. | SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id JOIN event AS t3 ON t2.event_id = t3.id JOIN stadium AS t4 ON t4.id = t3.stadium_id WHERE t1.nationality = 'Australia' | [
"SELECT",
"t4.name",
"FROM",
"swimmer",
"AS",
"t1",
"JOIN",
"record",
"AS",
"t2",
"ON",
"t1.id",
"=",
"t2.swimmer_id",
"JOIN",
"event",
"AS",
"t3",
"ON",
"t2.event_id",
"=",
"t3.id",
"JOIN",
"stadium",
"AS",
"t4",
"ON",
"t4.id",
"=",
"t3.stadium_id",
"WHERE",
"t1.nationality",
"=",
"'Australia",
"'"
] | [
"select",
"t4",
".",
"name",
"from",
"swimmer",
"as",
"t1",
"join",
"record",
"as",
"t2",
"on",
"t1",
".",
"id",
"=",
"t2",
".",
"swimmer_id",
"join",
"event",
"as",
"t3",
"on",
"t2",
".",
"event_id",
"=",
"t3",
".",
"id",
"join",
"stadium",
"as",
"t4",
"on",
"t4",
".",
"id",
"=",
"t3",
".",
"stadium_id",
"where",
"t1",
".",
"nationality",
"=",
"value"
] | [
"Find",
"the",
"names",
"of",
"stadiums",
"that",
"some",
"Australian",
"swimmers",
"have",
"been",
"to",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find the names of stadiums that the most swimmers have been to. | SELECT t3.name FROM record AS t1 JOIN event AS t2 ON t1.event_id = t2.id JOIN stadium AS t3 ON t3.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"t3.name",
"FROM",
"record",
"AS",
"t1",
"JOIN",
"event",
"AS",
"t2",
"ON",
"t1.event_id",
"=",
"t2.id",
"JOIN",
"stadium",
"AS",
"t3",
"ON",
"t3.id",
"=",
"t2.stadium_id",
"GROUP",
"BY",
"t2.stadium_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t3",
".",
"name",
"from",
"record",
"as",
"t1",
"join",
"event",
"as",
"t2",
"on",
"t1",
".",
"event_id",
"=",
"t2",
".",
"id",
"join",
"stadium",
"as",
"t3",
"on",
"t3",
".",
"id",
"=",
"t2",
".",
"stadium_id",
"group",
"by",
"t2",
".",
"stadium_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Find",
"the",
"names",
"of",
"stadiums",
"that",
"the",
"most",
"swimmers",
"have",
"been",
"to",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | Find all details for each swimmer. | SELECT * FROM swimmer | [
"SELECT",
"*",
"FROM",
"swimmer"
] | [
"select",
"*",
"from",
"swimmer"
] | [
"Find",
"all",
"details",
"for",
"each",
"swimmer",
"."
] |
swimming | [
"CREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);",
"CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);",
"CREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);"
] | What is the average capacity of the stadiums that were opened in year 2005? | SELECT avg(capacity) FROM stadium WHERE opening_year = 2005 | [
"SELECT",
"avg",
"(",
"capacity",
")",
"FROM",
"stadium",
"WHERE",
"opening_year",
"=",
"2005"
] | [
"select",
"avg",
"(",
"capacity",
")",
"from",
"stadium",
"where",
"opening_year",
"=",
"value"
] | [
"What",
"is",
"the",
"average",
"capacity",
"of",
"the",
"stadiums",
"that",
"were",
"opened",
"in",
"year",
"2005",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | How many railways are there? | SELECT count(*) FROM railway | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"railway"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"railway"
] | [
"How",
"many",
"railways",
"are",
"there",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | List the builders of railways in ascending alphabetical order. | SELECT Builder FROM railway ORDER BY Builder ASC | [
"SELECT",
"Builder",
"FROM",
"railway",
"ORDER",
"BY",
"Builder",
"ASC"
] | [
"select",
"builder",
"from",
"railway",
"order",
"by",
"builder",
"asc"
] | [
"List",
"the",
"builders",
"of",
"railways",
"in",
"ascending",
"alphabetical",
"order",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | List the wheels and locations of the railways. | SELECT Wheels , LOCATION FROM railway | [
"SELECT",
"Wheels",
",",
"LOCATION",
"FROM",
"railway"
] | [
"select",
"wheels",
",",
"location",
"from",
"railway"
] | [
"List",
"the",
"wheels",
"and",
"locations",
"of",
"the",
"railways",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | What is the maximum level of managers in countries that are not "Australia"? | SELECT max(LEVEL) FROM manager WHERE Country != "Australia " | [
"SELECT",
"max",
"(",
"LEVEL",
")",
"FROM",
"manager",
"WHERE",
"Country",
"!",
"=",
"``",
"Australia",
"''"
] | [
"select",
"max",
"(",
"level",
")",
"from",
"manager",
"where",
"country",
"!",
"=",
"value"
] | [
"What",
"is",
"the",
"maximum",
"level",
"of",
"managers",
"in",
"countries",
"that",
"are",
"not",
"``",
"Australia",
"''",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | What is the average age for all managers? | SELECT avg(Age) FROM manager | [
"SELECT",
"avg",
"(",
"Age",
")",
"FROM",
"manager"
] | [
"select",
"avg",
"(",
"age",
")",
"from",
"manager"
] | [
"What",
"is",
"the",
"average",
"age",
"for",
"all",
"managers",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | What are the names of managers in ascending order of level? | SELECT Name FROM manager ORDER BY LEVEL ASC | [
"SELECT",
"Name",
"FROM",
"manager",
"ORDER",
"BY",
"LEVEL",
"ASC"
] | [
"select",
"name",
"from",
"manager",
"order",
"by",
"level",
"asc"
] | [
"What",
"are",
"the",
"names",
"of",
"managers",
"in",
"ascending",
"order",
"of",
"level",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | What are the names and arrival times of trains? | SELECT Name , Arrival FROM train | [
"SELECT",
"Name",
",",
"Arrival",
"FROM",
"train"
] | [
"select",
"name",
",",
"arrival",
"from",
"train"
] | [
"What",
"are",
"the",
"names",
"and",
"arrival",
"times",
"of",
"trains",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | What is the name of the oldest manager? | SELECT Name FROM manager ORDER BY Age DESC LIMIT 1 | [
"SELECT",
"Name",
"FROM",
"manager",
"ORDER",
"BY",
"Age",
"DESC",
"LIMIT",
"1"
] | [
"select",
"name",
"from",
"manager",
"order",
"by",
"age",
"desc",
"limit",
"value"
] | [
"What",
"is",
"the",
"name",
"of",
"the",
"oldest",
"manager",
"?"
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the names of trains and locations of railways they are in. | SELECT T2.Name , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID | [
"SELECT",
"T2.Name",
",",
"T1.Location",
"FROM",
"railway",
"AS",
"T1",
"JOIN",
"train",
"AS",
"T2",
"ON",
"T1.Railway_ID",
"=",
"T2.Railway_ID"
] | [
"select",
"t2",
".",
"name",
",",
"t1",
".",
"location",
"from",
"railway",
"as",
"t1",
"join",
"train",
"as",
"t2",
"on",
"t1",
".",
"railway_id",
"=",
"t2",
".",
"railway_id"
] | [
"Show",
"the",
"names",
"of",
"trains",
"and",
"locations",
"of",
"railways",
"they",
"are",
"in",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the builder of railways associated with the trains named "Andaman Exp". | SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp" | [
"SELECT",
"T1.Builder",
"FROM",
"railway",
"AS",
"T1",
"JOIN",
"train",
"AS",
"T2",
"ON",
"T1.Railway_ID",
"=",
"T2.Railway_ID",
"WHERE",
"T2.Name",
"=",
"``",
"Andaman",
"Exp",
"''"
] | [
"select",
"t1",
".",
"builder",
"from",
"railway",
"as",
"t1",
"join",
"train",
"as",
"t2",
"on",
"t1",
".",
"railway_id",
"=",
"t2",
".",
"railway_id",
"where",
"t2",
".",
"name",
"=",
"value"
] | [
"Show",
"the",
"builder",
"of",
"railways",
"associated",
"with",
"the",
"trains",
"named",
"``",
"Andaman",
"Exp",
"''",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show id and location of railways that are associated with more than one train. | SELECT T2.Railway_ID , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1 | [
"SELECT",
"T2.Railway_ID",
",",
"T1.Location",
"FROM",
"railway",
"AS",
"T1",
"JOIN",
"train",
"AS",
"T2",
"ON",
"T1.Railway_ID",
"=",
"T2.Railway_ID",
"GROUP",
"BY",
"T2.Railway_ID",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"1"
] | [
"select",
"t2",
".",
"railway_id",
",",
"t1",
".",
"location",
"from",
"railway",
"as",
"t1",
"join",
"train",
"as",
"t2",
"on",
"t1",
".",
"railway_id",
"=",
"t2",
".",
"railway_id",
"group",
"by",
"t2",
".",
"railway_id",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Show",
"id",
"and",
"location",
"of",
"railways",
"that",
"are",
"associated",
"with",
"more",
"than",
"one",
"train",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the id and builder of the railway that are associated with the most trains. | SELECT T2.Railway_ID , T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1 | [
"SELECT",
"T2.Railway_ID",
",",
"T1.Builder",
"FROM",
"railway",
"AS",
"T1",
"JOIN",
"train",
"AS",
"T2",
"ON",
"T1.Railway_ID",
"=",
"T2.Railway_ID",
"GROUP",
"BY",
"T2.Railway_ID",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t2",
".",
"railway_id",
",",
"t1",
".",
"builder",
"from",
"railway",
"as",
"t1",
"join",
"train",
"as",
"t2",
"on",
"t1",
".",
"railway_id",
"=",
"t2",
".",
"railway_id",
"group",
"by",
"t2",
".",
"railway_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Show",
"the",
"id",
"and",
"builder",
"of",
"the",
"railway",
"that",
"are",
"associated",
"with",
"the",
"most",
"trains",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show different builders of railways, along with the corresponding number of railways using each builder. | SELECT Builder , COUNT(*) FROM railway GROUP BY Builder | [
"SELECT",
"Builder",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"railway",
"GROUP",
"BY",
"Builder"
] | [
"select",
"builder",
",",
"count",
"(",
"*",
")",
"from",
"railway",
"group",
"by",
"builder"
] | [
"Show",
"different",
"builders",
"of",
"railways",
",",
"along",
"with",
"the",
"corresponding",
"number",
"of",
"railways",
"using",
"each",
"builder",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the most common builder of railways. | SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1 | [
"SELECT",
"Builder",
"FROM",
"railway",
"GROUP",
"BY",
"Builder",
"ORDER",
"BY",
"COUNT",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"builder",
"from",
"railway",
"group",
"by",
"builder",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Show",
"the",
"most",
"common",
"builder",
"of",
"railways",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show different locations of railways along with the corresponding number of railways at each location. | SELECT LOCATION , COUNT(*) FROM railway GROUP BY LOCATION | [
"SELECT",
"LOCATION",
",",
"COUNT",
"(",
"*",
")",
"FROM",
"railway",
"GROUP",
"BY",
"LOCATION"
] | [
"select",
"location",
",",
"count",
"(",
"*",
")",
"from",
"railway",
"group",
"by",
"location"
] | [
"Show",
"different",
"locations",
"of",
"railways",
"along",
"with",
"the",
"corresponding",
"number",
"of",
"railways",
"at",
"each",
"location",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the locations that have more than one railways. | SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1 | [
"SELECT",
"LOCATION",
"FROM",
"railway",
"GROUP",
"BY",
"LOCATION",
"HAVING",
"COUNT",
"(",
"*",
")",
">",
"1"
] | [
"select",
"location",
"from",
"railway",
"group",
"by",
"location",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Show",
"the",
"locations",
"that",
"have",
"more",
"than",
"one",
"railways",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | List the object number of railways that do not have any trains. | SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN (SELECT Railway_ID FROM train) | [
"SELECT",
"ObjectNumber",
"FROM",
"railway",
"WHERE",
"Railway_ID",
"NOT",
"IN",
"(",
"SELECT",
"Railway_ID",
"FROM",
"train",
")"
] | [
"select",
"objectnumber",
"from",
"railway",
"where",
"railway_id",
"not",
"in",
"(",
"select",
"railway_id",
"from",
"train",
")"
] | [
"List",
"the",
"object",
"number",
"of",
"railways",
"that",
"do",
"not",
"have",
"any",
"trains",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the countries that have both managers of age above 50 and managers of age below 46. | SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46 | [
"SELECT",
"Country",
"FROM",
"manager",
"WHERE",
"Age",
">",
"50",
"INTERSECT",
"SELECT",
"Country",
"FROM",
"manager",
"WHERE",
"Age",
"<",
"46"
] | [
"select",
"country",
"from",
"manager",
"where",
"age",
">",
"value",
"intersect",
"select",
"country",
"from",
"manager",
"where",
"age",
"<",
"value"
] | [
"Show",
"the",
"countries",
"that",
"have",
"both",
"managers",
"of",
"age",
"above",
"50",
"and",
"managers",
"of",
"age",
"below",
"46",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the distinct countries of managers. | SELECT DISTINCT Country FROM manager | [
"SELECT",
"DISTINCT",
"Country",
"FROM",
"manager"
] | [
"select",
"distinct",
"country",
"from",
"manager"
] | [
"Show",
"the",
"distinct",
"countries",
"of",
"managers",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the working years of managers in descending order of their level. | SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC | [
"SELECT",
"Working_year_starts",
"FROM",
"manager",
"ORDER",
"BY",
"LEVEL",
"DESC"
] | [
"select",
"working_year_starts",
"from",
"manager",
"order",
"by",
"level",
"desc"
] | [
"Show",
"the",
"working",
"years",
"of",
"managers",
"in",
"descending",
"order",
"of",
"their",
"level",
"."
] |
railway | [
"CREATE TABLE \"railway\" (\n\"Railway_ID\" int,\n\"Railway\" text,\n\"Builder\" text,\n\"Built\" text,\n\"Wheels\" text,\n\"Location\" text,\n\"ObjectNumber\" text,\nPRIMARY KEY (\"Railway_ID\")\n);",
"CREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Train_Num\" text,\n\"Name\" text,\n\"From\" text,\n\"Arrival\" text,\n\"Railway_ID\" int,\nPRIMARY KEY (\"Train_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES `railway`(\"Railway_ID\")\n);",
"CREATE TABLE \"manager\" (\n\"Manager_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Working_year_starts\" text,\n\"Age\" int,\n\"Level\" int,\nPRIMARY KEY (\"Manager_ID\")\n);",
"CREATE TABLE \"railway_manage\" (\n\"Railway_ID\" int,\n\"Manager_ID\" int,\n\"From_Year\" text,\nPRIMARY KEY (\"Railway_ID\",\"Manager_ID\"),\nFOREIGN KEY (\"Manager_ID\") REFERENCES \"manager\"(\"Manager_ID\"),\nFOREIGN KEY (\"Railway_ID\") REFERENCES \"railway\"(\"Railway_ID\")\n);"
] | Show the countries that have managers of age above 50 or below 46. | SELECT Country FROM manager WHERE Age > 50 OR Age < 46 | [
"SELECT",
"Country",
"FROM",
"manager",
"WHERE",
"Age",
">",
"50",
"OR",
"Age",
"<",
"46"
] | [
"select",
"country",
"from",
"manager",
"where",
"age",
">",
"value",
"or",
"age",
"<",
"value"
] | [
"Show",
"the",
"countries",
"that",
"have",
"managers",
"of",
"age",
"above",
"50",
"or",
"below",
"46",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | How many addresses are there in country USA? | SELECT count(*) FROM addresses WHERE country = 'USA' | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"addresses",
"WHERE",
"country",
"=",
"'USA",
"'"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"addresses",
"where",
"country",
"=",
"value"
] | [
"How",
"many",
"addresses",
"are",
"there",
"in",
"country",
"USA",
"?"
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show all distinct cities in the address record. | SELECT DISTINCT city FROM addresses | [
"SELECT",
"DISTINCT",
"city",
"FROM",
"addresses"
] | [
"select",
"distinct",
"city",
"from",
"addresses"
] | [
"Show",
"all",
"distinct",
"cities",
"in",
"the",
"address",
"record",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show each state and the number of addresses in each state. | SELECT state_province_county , count(*) FROM addresses GROUP BY state_province_county | [
"SELECT",
"state_province_county",
",",
"count",
"(",
"*",
")",
"FROM",
"addresses",
"GROUP",
"BY",
"state_province_county"
] | [
"select",
"state_province_county",
",",
"count",
"(",
"*",
")",
"from",
"addresses",
"group",
"by",
"state_province_county"
] | [
"Show",
"each",
"state",
"and",
"the",
"number",
"of",
"addresses",
"in",
"each",
"state",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show names and phones of customers who do not have address information. | SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history) | [
"SELECT",
"customer_name",
",",
"customer_phone",
"FROM",
"customers",
"WHERE",
"customer_id",
"NOT",
"IN",
"(",
"SELECT",
"customer_id",
"FROM",
"customer_address_history",
")"
] | [
"select",
"customer_name",
",",
"customer_phone",
"from",
"customers",
"where",
"customer_id",
"not",
"in",
"(",
"select",
"customer_id",
"from",
"customer_address_history",
")"
] | [
"Show",
"names",
"and",
"phones",
"of",
"customers",
"who",
"do",
"not",
"have",
"address",
"information",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the name of the customer who has the most orders. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1 | [
"SELECT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"GROUP",
"BY",
"T1.customer_id",
"ORDER",
"BY",
"count",
"(",
"*",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"group",
"by",
"t1",
".",
"customer_id",
"order",
"by",
"count",
"(",
"*",
")",
"desc",
"limit",
"value"
] | [
"Show",
"the",
"name",
"of",
"the",
"customer",
"who",
"has",
"the",
"most",
"orders",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the product type codes which have at least two products. | SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*) >= 2 | [
"SELECT",
"product_type_code",
"FROM",
"products",
"GROUP",
"BY",
"product_type_code",
"HAVING",
"count",
"(",
"*",
")",
">",
"=",
"2"
] | [
"select",
"product_type_code",
"from",
"products",
"group",
"by",
"product_type_code",
"having",
"count",
"(",
"*",
")",
">",
"=",
"value"
] | [
"Show",
"the",
"product",
"type",
"codes",
"which",
"have",
"at",
"least",
"two",
"products",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the names of customers who have both an order in completed status and an order in part status. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part' | [
"SELECT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"'Completed",
"'",
"INTERSECT",
"SELECT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T2.order_status_code",
"=",
"'Part",
"'"
] | [
"select",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value",
"intersect",
"select",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t2",
".",
"order_status_code",
"=",
"value"
] | [
"Show",
"the",
"names",
"of",
"customers",
"who",
"have",
"both",
"an",
"order",
"in",
"completed",
"status",
"and",
"an",
"order",
"in",
"part",
"status",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the name, phone, and payment method code for all customers in descending order of customer number. | SELECT customer_name , customer_phone , payment_method_code FROM customers ORDER BY customer_number DESC | [
"SELECT",
"customer_name",
",",
"customer_phone",
",",
"payment_method_code",
"FROM",
"customers",
"ORDER",
"BY",
"customer_number",
"DESC"
] | [
"select",
"customer_name",
",",
"customer_phone",
",",
"payment_method_code",
"from",
"customers",
"order",
"by",
"customer_number",
"desc"
] | [
"Show",
"the",
"name",
",",
"phone",
",",
"and",
"payment",
"method",
"code",
"for",
"all",
"customers",
"in",
"descending",
"order",
"of",
"customer",
"number",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the product name and total order quantity for each product. | SELECT T1.product_name , sum(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id | [
"SELECT",
"T1.product_name",
",",
"sum",
"(",
"T2.order_quantity",
")",
"FROM",
"products",
"AS",
"T1",
"JOIN",
"order_items",
"AS",
"T2",
"ON",
"T1.product_id",
"=",
"T2.product_id",
"GROUP",
"BY",
"T1.product_id"
] | [
"select",
"t1",
".",
"product_name",
",",
"sum",
"(",
"t2",
".",
"order_quantity",
")",
"from",
"products",
"as",
"t1",
"join",
"order_items",
"as",
"t2",
"on",
"t1",
".",
"product_id",
"=",
"t2",
".",
"product_id",
"group",
"by",
"t1",
".",
"product_id"
] | [
"Show",
"the",
"product",
"name",
"and",
"total",
"order",
"quantity",
"for",
"each",
"product",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the minimum, maximum, average price for all products. | SELECT min(product_price) , max(product_price) , avg(product_price) FROM products | [
"SELECT",
"min",
"(",
"product_price",
")",
",",
"max",
"(",
"product_price",
")",
",",
"avg",
"(",
"product_price",
")",
"FROM",
"products"
] | [
"select",
"min",
"(",
"product_price",
")",
",",
"max",
"(",
"product_price",
")",
",",
"avg",
"(",
"product_price",
")",
"from",
"products"
] | [
"Show",
"the",
"minimum",
",",
"maximum",
",",
"average",
"price",
"for",
"all",
"products",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | How many products have a price higher than the average? | SELECT count(*) FROM products WHERE product_price > (SELECT avg(product_price) FROM products) | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"products",
"WHERE",
"product_price",
">",
"(",
"SELECT",
"avg",
"(",
"product_price",
")",
"FROM",
"products",
")"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"products",
"where",
"product_price",
">",
"(",
"select",
"avg",
"(",
"product_price",
")",
"from",
"products",
")"
] | [
"How",
"many",
"products",
"have",
"a",
"price",
"higher",
"than",
"the",
"average",
"?"
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the customer name, customer address city, date from, and date to for each customer address history. | SELECT T2.customer_name , T3.city , T1.date_from , T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id | [
"SELECT",
"T2.customer_name",
",",
"T3.city",
",",
"T1.date_from",
",",
"T1.date_to",
"FROM",
"customer_address_history",
"AS",
"T1",
"JOIN",
"customers",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"addresses",
"AS",
"T3",
"ON",
"T1.address_id",
"=",
"T3.address_id"
] | [
"select",
"t2",
".",
"customer_name",
",",
"t3",
".",
"city",
",",
"t1",
".",
"date_from",
",",
"t1",
".",
"date_to",
"from",
"customer_address_history",
"as",
"t1",
"join",
"customers",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"addresses",
"as",
"t3",
"on",
"t1",
".",
"address_id",
"=",
"t3",
".",
"address_id"
] | [
"Show",
"the",
"customer",
"name",
",",
"customer",
"address",
"city",
",",
"date",
"from",
",",
"and",
"date",
"to",
"for",
"each",
"customer",
"address",
"history",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the names of customers who use Credit Card payment method and have more than 2 orders. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING count(*) > 2 | [
"SELECT",
"T1.customer_name",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"WHERE",
"T1.payment_method_code",
"=",
"'Credit",
"Card",
"'",
"GROUP",
"BY",
"T1.customer_id",
"HAVING",
"count",
"(",
"*",
")",
">",
"2"
] | [
"select",
"t1",
".",
"customer_name",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"where",
"t1",
".",
"payment_method_code",
"=",
"value",
"group",
"by",
"t1",
".",
"customer_id",
"having",
"count",
"(",
"*",
")",
">",
"value"
] | [
"Show",
"the",
"names",
"of",
"customers",
"who",
"use",
"Credit",
"Card",
"payment",
"method",
"and",
"have",
"more",
"than",
"2",
"orders",
"."
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | What are the name and phone of the customer with the most ordered product quantity? | SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC LIMIT 1 | [
"SELECT",
"T1.customer_name",
",",
"T1.customer_phone",
"FROM",
"customers",
"AS",
"T1",
"JOIN",
"customer_orders",
"AS",
"T2",
"ON",
"T1.customer_id",
"=",
"T2.customer_id",
"JOIN",
"order_items",
"AS",
"T3",
"ON",
"T3.order_id",
"=",
"T2.order_id",
"GROUP",
"BY",
"T1.customer_id",
"ORDER",
"BY",
"sum",
"(",
"T3.order_quantity",
")",
"DESC",
"LIMIT",
"1"
] | [
"select",
"t1",
".",
"customer_name",
",",
"t1",
".",
"customer_phone",
"from",
"customers",
"as",
"t1",
"join",
"customer_orders",
"as",
"t2",
"on",
"t1",
".",
"customer_id",
"=",
"t2",
".",
"customer_id",
"join",
"order_items",
"as",
"t3",
"on",
"t3",
".",
"order_id",
"=",
"t2",
".",
"order_id",
"group",
"by",
"t1",
".",
"customer_id",
"order",
"by",
"sum",
"(",
"t3",
".",
"order_quantity",
")",
"desc",
"limit",
"value"
] | [
"What",
"are",
"the",
"name",
"and",
"phone",
"of",
"the",
"customer",
"with",
"the",
"most",
"ordered",
"product",
"quantity",
"?"
] |
customers_and_products_contacts | [
"CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);",
"CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);",
"CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);",
"CREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);",
"CREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);",
"CREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);",
"CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);"
] | Show the product type and name for the products with price higher than 1000 or lower than 500. | SELECT product_type_code , product_name FROM products WHERE product_price > 1000 OR product_price < 500 | [
"SELECT",
"product_type_code",
",",
"product_name",
"FROM",
"products",
"WHERE",
"product_price",
">",
"1000",
"OR",
"product_price",
"<",
"500"
] | [
"select",
"product_type_code",
",",
"product_name",
"from",
"products",
"where",
"product_price",
">",
"value",
"or",
"product_price",
"<",
"value"
] | [
"Show",
"the",
"product",
"type",
"and",
"name",
"for",
"the",
"products",
"with",
"price",
"higher",
"than",
"1000",
"or",
"lower",
"than",
"500",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the name of dorms only for female (F gender). | SELECT dorm_name FROM dorm WHERE gender = 'F' | [
"SELECT",
"dorm_name",
"FROM",
"dorm",
"WHERE",
"gender",
"=",
"'F",
"'"
] | [
"select",
"dorm_name",
"from",
"dorm",
"where",
"gender",
"=",
"value"
] | [
"Find",
"the",
"name",
"of",
"dorms",
"only",
"for",
"female",
"(",
"F",
"gender",
")",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What are the names of the all-female dorms? | SELECT dorm_name FROM dorm WHERE gender = 'F' | [
"SELECT",
"dorm_name",
"FROM",
"dorm",
"WHERE",
"gender",
"=",
"'F",
"'"
] | [
"select",
"dorm_name",
"from",
"dorm",
"where",
"gender",
"=",
"value"
] | [
"What",
"are",
"the",
"names",
"of",
"the",
"all-female",
"dorms",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the name of dorms that can accommodate more than 300 students. | SELECT dorm_name FROM dorm WHERE student_capacity > 300 | [
"SELECT",
"dorm_name",
"FROM",
"dorm",
"WHERE",
"student_capacity",
">",
"300"
] | [
"select",
"dorm_name",
"from",
"dorm",
"where",
"student_capacity",
">",
"value"
] | [
"Find",
"the",
"name",
"of",
"dorms",
"that",
"can",
"accommodate",
"more",
"than",
"300",
"students",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What are the names of all the dorms that can accomdate more than 300 students? | SELECT dorm_name FROM dorm WHERE student_capacity > 300 | [
"SELECT",
"dorm_name",
"FROM",
"dorm",
"WHERE",
"student_capacity",
">",
"300"
] | [
"select",
"dorm_name",
"from",
"dorm",
"where",
"student_capacity",
">",
"value"
] | [
"What",
"are",
"the",
"names",
"of",
"all",
"the",
"dorms",
"that",
"can",
"accomdate",
"more",
"than",
"300",
"students",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many female students (sex is F) whose age is below 25? | SELECT count(*) FROM student WHERE sex = 'F' AND age < 25 | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"student",
"WHERE",
"sex",
"=",
"'F",
"'",
"AND",
"age",
"<",
"25"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"student",
"where",
"sex",
"=",
"value",
"and",
"age",
"<",
"value"
] | [
"How",
"many",
"female",
"students",
"(",
"sex",
"is",
"F",
")",
"whose",
"age",
"is",
"below",
"25",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many girl students who are younger than 25? | SELECT count(*) FROM student WHERE sex = 'F' AND age < 25 | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"student",
"WHERE",
"sex",
"=",
"'F",
"'",
"AND",
"age",
"<",
"25"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"student",
"where",
"sex",
"=",
"value",
"and",
"age",
"<",
"value"
] | [
"How",
"many",
"girl",
"students",
"who",
"are",
"younger",
"than",
"25",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the first name of students who is older than 20. | SELECT fname FROM student WHERE age > 20 | [
"SELECT",
"fname",
"FROM",
"student",
"WHERE",
"age",
">",
"20"
] | [
"select",
"fname",
"from",
"student",
"where",
"age",
">",
"value"
] | [
"Find",
"the",
"first",
"name",
"of",
"students",
"who",
"is",
"older",
"than",
"20",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What are the first names of all students who are older than 20? | SELECT fname FROM student WHERE age > 20 | [
"SELECT",
"fname",
"FROM",
"student",
"WHERE",
"age",
">",
"20"
] | [
"select",
"fname",
"from",
"student",
"where",
"age",
">",
"value"
] | [
"What",
"are",
"the",
"first",
"names",
"of",
"all",
"students",
"who",
"are",
"older",
"than",
"20",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the first name of students living in city PHL whose age is between 20 and 25. | SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 | [
"SELECT",
"fname",
"FROM",
"student",
"WHERE",
"city_code",
"=",
"'PHL",
"'",
"AND",
"age",
"BETWEEN",
"20",
"AND",
"25"
] | [
"select",
"fname",
"from",
"student",
"where",
"city_code",
"=",
"value",
"and",
"age",
"between",
"value",
"and",
"value"
] | [
"Find",
"the",
"first",
"name",
"of",
"students",
"living",
"in",
"city",
"PHL",
"whose",
"age",
"is",
"between",
"20",
"and",
"25",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What is the first name of the students who are in age 20 to 25 and living in PHL city? | SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 | [
"SELECT",
"fname",
"FROM",
"student",
"WHERE",
"city_code",
"=",
"'PHL",
"'",
"AND",
"age",
"BETWEEN",
"20",
"AND",
"25"
] | [
"select",
"fname",
"from",
"student",
"where",
"city_code",
"=",
"value",
"and",
"age",
"between",
"value",
"and",
"value"
] | [
"What",
"is",
"the",
"first",
"name",
"of",
"the",
"students",
"who",
"are",
"in",
"age",
"20",
"to",
"25",
"and",
"living",
"in",
"PHL",
"city",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many dorms are there? | SELECT count(*) FROM dorm | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"dorm"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"dorm"
] | [
"How",
"many",
"dorms",
"are",
"there",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many dorms are in the database? | SELECT count(*) FROM dorm | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"dorm"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"dorm"
] | [
"How",
"many",
"dorms",
"are",
"in",
"the",
"database",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the number of distinct amenities. | SELECT count(*) FROM dorm_amenity | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"dorm_amenity"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"dorm_amenity"
] | [
"Find",
"the",
"number",
"of",
"distinct",
"amenities",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many diffrent dorm amenities are there? | SELECT count(*) FROM dorm_amenity | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"dorm_amenity"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"dorm_amenity"
] | [
"How",
"many",
"diffrent",
"dorm",
"amenities",
"are",
"there",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the total capacity of all dorms. | SELECT sum(student_capacity) FROM dorm | [
"SELECT",
"sum",
"(",
"student_capacity",
")",
"FROM",
"dorm"
] | [
"select",
"sum",
"(",
"student_capacity",
")",
"from",
"dorm"
] | [
"Find",
"the",
"total",
"capacity",
"of",
"all",
"dorms",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What is the total student capacity of all dorms? | SELECT sum(student_capacity) FROM dorm | [
"SELECT",
"sum",
"(",
"student_capacity",
")",
"FROM",
"dorm"
] | [
"select",
"sum",
"(",
"student_capacity",
")",
"from",
"dorm"
] | [
"What",
"is",
"the",
"total",
"student",
"capacity",
"of",
"all",
"dorms",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many students are there? | SELECT count(*) FROM student | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"student"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"student"
] | [
"How",
"many",
"students",
"are",
"there",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many students exist? | SELECT count(*) FROM student | [
"SELECT",
"count",
"(",
"*",
")",
"FROM",
"student"
] | [
"select",
"count",
"(",
"*",
")",
"from",
"student"
] | [
"How",
"many",
"students",
"exist",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the average age of all students living in the each city. | SELECT avg(age) , city_code FROM student GROUP BY city_code | [
"SELECT",
"avg",
"(",
"age",
")",
",",
"city_code",
"FROM",
"student",
"GROUP",
"BY",
"city_code"
] | [
"select",
"avg",
"(",
"age",
")",
",",
"city_code",
"from",
"student",
"group",
"by",
"city_code"
] | [
"Find",
"the",
"average",
"age",
"of",
"all",
"students",
"living",
"in",
"the",
"each",
"city",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What is the average age for each city and what are those cities? | SELECT avg(age) , city_code FROM student GROUP BY city_code | [
"SELECT",
"avg",
"(",
"age",
")",
",",
"city_code",
"FROM",
"student",
"GROUP",
"BY",
"city_code"
] | [
"select",
"avg",
"(",
"age",
")",
",",
"city_code",
"from",
"student",
"group",
"by",
"city_code"
] | [
"What",
"is",
"the",
"average",
"age",
"for",
"each",
"city",
"and",
"what",
"are",
"those",
"cities",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the average and total capacity of dorms for the students with gender X. | SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X' | [
"SELECT",
"avg",
"(",
"student_capacity",
")",
",",
"sum",
"(",
"student_capacity",
")",
"FROM",
"dorm",
"WHERE",
"gender",
"=",
"'X",
"'"
] | [
"select",
"avg",
"(",
"student_capacity",
")",
",",
"sum",
"(",
"student_capacity",
")",
"from",
"dorm",
"where",
"gender",
"=",
"value"
] | [
"Find",
"the",
"average",
"and",
"total",
"capacity",
"of",
"dorms",
"for",
"the",
"students",
"with",
"gender",
"X",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What is the average and total capacity for all dorms who are of gender X? | SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X' | [
"SELECT",
"avg",
"(",
"student_capacity",
")",
",",
"sum",
"(",
"student_capacity",
")",
"FROM",
"dorm",
"WHERE",
"gender",
"=",
"'X",
"'"
] | [
"select",
"avg",
"(",
"student_capacity",
")",
",",
"sum",
"(",
"student_capacity",
")",
"from",
"dorm",
"where",
"gender",
"=",
"value"
] | [
"What",
"is",
"the",
"average",
"and",
"total",
"capacity",
"for",
"all",
"dorms",
"who",
"are",
"of",
"gender",
"X",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the number of dorms that have some amenity. | SELECT count(DISTINCT dormid) FROM has_amenity | [
"SELECT",
"count",
"(",
"DISTINCT",
"dormid",
")",
"FROM",
"has_amenity"
] | [
"select",
"count",
"(",
"distinct",
"dormid",
")",
"from",
"has_amenity"
] | [
"Find",
"the",
"number",
"of",
"dorms",
"that",
"have",
"some",
"amenity",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many dorms have amenities? | SELECT count(DISTINCT dormid) FROM has_amenity | [
"SELECT",
"count",
"(",
"DISTINCT",
"dormid",
")",
"FROM",
"has_amenity"
] | [
"select",
"count",
"(",
"distinct",
"dormid",
")",
"from",
"has_amenity"
] | [
"How",
"many",
"dorms",
"have",
"amenities",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the name of dorms that do not have any amenity | SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity) | [
"SELECT",
"dorm_name",
"FROM",
"dorm",
"WHERE",
"dormid",
"NOT",
"IN",
"(",
"SELECT",
"dormid",
"FROM",
"has_amenity",
")"
] | [
"select",
"dorm_name",
"from",
"dorm",
"where",
"dormid",
"not",
"in",
"(",
"select",
"dormid",
"from",
"has_amenity",
")"
] | [
"Find",
"the",
"name",
"of",
"dorms",
"that",
"do",
"not",
"have",
"any",
"amenity"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What are the names of all the dorms that don't have any amenities? | SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity) | [
"SELECT",
"dorm_name",
"FROM",
"dorm",
"WHERE",
"dormid",
"NOT",
"IN",
"(",
"SELECT",
"dormid",
"FROM",
"has_amenity",
")"
] | [
"select",
"dorm_name",
"from",
"dorm",
"where",
"dormid",
"not",
"in",
"(",
"select",
"dormid",
"from",
"has_amenity",
")"
] | [
"What",
"are",
"the",
"names",
"of",
"all",
"the",
"dorms",
"that",
"do",
"n't",
"have",
"any",
"amenities",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the number of distinct gender for dorms. | SELECT count(DISTINCT gender) FROM dorm | [
"SELECT",
"count",
"(",
"DISTINCT",
"gender",
")",
"FROM",
"dorm"
] | [
"select",
"count",
"(",
"distinct",
"gender",
")",
"from",
"dorm"
] | [
"Find",
"the",
"number",
"of",
"distinct",
"gender",
"for",
"dorms",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | How many different genders are there in the dorms? | SELECT count(DISTINCT gender) FROM dorm | [
"SELECT",
"count",
"(",
"DISTINCT",
"gender",
")",
"FROM",
"dorm"
] | [
"select",
"count",
"(",
"distinct",
"gender",
")",
"from",
"dorm"
] | [
"How",
"many",
"different",
"genders",
"are",
"there",
"in",
"the",
"dorms",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the capacity and gender type of the dorm whose name has substring ‘Donor’. | SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%' | [
"SELECT",
"student_capacity",
",",
"gender",
"FROM",
"dorm",
"WHERE",
"dorm_name",
"LIKE",
"'",
"%",
"Donor",
"%",
"'"
] | [
"select",
"student_capacity",
",",
"gender",
"from",
"dorm",
"where",
"dorm_name",
"like",
"value"
] | [
"Find",
"the",
"capacity",
"and",
"gender",
"type",
"of",
"the",
"dorm",
"whose",
"name",
"has",
"substring",
"‘Donor’",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What is the student capacity and type of gender for the dorm whose name as the phrase Donor in it? | SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%' | [
"SELECT",
"student_capacity",
",",
"gender",
"FROM",
"dorm",
"WHERE",
"dorm_name",
"LIKE",
"'",
"%",
"Donor",
"%",
"'"
] | [
"select",
"student_capacity",
",",
"gender",
"from",
"dorm",
"where",
"dorm_name",
"like",
"value"
] | [
"What",
"is",
"the",
"student",
"capacity",
"and",
"type",
"of",
"gender",
"for",
"the",
"dorm",
"whose",
"name",
"as",
"the",
"phrase",
"Donor",
"in",
"it",
"?"
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100. | SELECT dorm_name , gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 | [
"SELECT",
"dorm_name",
",",
"gender",
"FROM",
"dorm",
"WHERE",
"student_capacity",
">",
"300",
"OR",
"student_capacity",
"<",
"100"
] | [
"select",
"dorm_name",
",",
"gender",
"from",
"dorm",
"where",
"student_capacity",
">",
"value",
"or",
"student_capacity",
"<",
"value"
] | [
"Find",
"the",
"name",
"and",
"gender",
"type",
"of",
"the",
"dorms",
"whose",
"capacity",
"is",
"greater",
"than",
"300",
"or",
"less",
"than",
"100",
"."
] |
dorm_1 | [
"create table Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );",
"create table Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n) ;",
"create table Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n) ;",
"create table Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);",
"create table Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);"
] | What are the names and types of the dorms that have a capacity greater than 300 or less than 100? | SELECT dorm_name , gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 | [
"SELECT",
"dorm_name",
",",
"gender",
"FROM",
"dorm",
"WHERE",
"student_capacity",
">",
"300",
"OR",
"student_capacity",
"<",
"100"
] | [
"select",
"dorm_name",
",",
"gender",
"from",
"dorm",
"where",
"student_capacity",
">",
"value",
"or",
"student_capacity",
"<",
"value"
] | [
"What",
"are",
"the",
"names",
"and",
"types",
"of",
"the",
"dorms",
"that",
"have",
"a",
"capacity",
"greater",
"than",
"300",
"or",
"less",
"than",
"100",
"?"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.