db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
db_schema_T
stringlengths
79
5k
db_schema
stringclasses
69 values
difficulty
stringclasses
1 value
question_id
int64
0
9.43k
__index_level_0__
int64
0
9.43k
db_schema_TC
stringlengths
41
1.68k
sql_constructs
listlengths
2
17
sql_complexity
int64
2
46
sql_complexity_buckets
stringclasses
3 values
few_shots
dict
regional_sales
State the delivery date of cookware.
Cookware is the name of the product;
SELECT T FROM ( SELECT DISTINCT IIF(T2.`Product Name` = 'Cookware', T1.DeliveryDate, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,611
2,611
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( DeliveryDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "SELECT", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 202, 438, 724, 832, 837, 880 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many furniture cushions orders which have date of order in 2018?
furniture cushions orders refer to OrderNumber where Product Name = 'Furniture Cushions'; date of order in 2018 refers to SUBSTR(OrderDate, -2) = '18'
SELECT SUM(CASE WHEN T1.OrderDate LIKE '%/%/18' AND T2.`Product Name` = 'Furniture Cushions' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,612
2,612
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "FROM" ]
11
medium
{ "case_1": [ 202, 438, 832, 880 ], "case_2": [ 202, 438, 832, 880 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 918, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 4, 5, 6, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 59, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 81, 82, 83, 85, 88, 90, 93, 94, 95, 96, 98, 99, 104, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 136, 138, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 200, 201, 202, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 247, 248, 254, 256, 258, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 304, 313, 314, 315, 316, 317, 319, 322, 323, 325, 330, 335, 339, 341, 347, 356, 360, 361, 363, 365, 368, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 407, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 430, 433, 436, 437, 438, 440, 444, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 483, 486, 487, 488, 490, 493, 494, 496, 497, 498, 500, 504, 507, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 605, 608, 609, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 630, 632, 633, 637, 638, 640, 641, 643, 646, 648, 650, 651, 658, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 706, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 774, 775, 776, 777, 780, 783, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 819, 823, 824, 825, 827, 828, 829, 830, 832, 835, 838, 841, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 875, 877, 878, 879, 880, 886, 888, 892, 895, 896, 902, 905, 907, 909, 912, 917, 918, 922, 923, 924, 926, 928, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 979, 980, 985, 986, 991, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1058, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1128, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
List out the name of products which have been applied 10% discount.
applied 10% discount refers to Discount Applied = 0.1;
SELECT T FROM ( SELECT DISTINCT IIF(T1.`Discount Applied` = 0.1, T2.`Product Name`, NULL) AS T FROM `Sales Orders` T1 INNER JOIN Products T2 ON T2.ProductID = T1._ProductID ) WHERE T IS NOT NULL
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,613
2,613
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Discount Applied" REAL )
[ "AS", "SELECT", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 202, 438, 724, 832, 837, 880 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Calculate the average net profit of phones which have sales channel of distributor.
net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Phones' and Sales Channel = 'Distributor';
SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Phones' AND T1.`Sales Channel` = 'Distributor'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,614
2,614
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "AS", "AND", "SELECT", "SUM", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Calculate the average net profit of bar tools which has ordered quantity exceed 5.
net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Bar Tools' and Order Quantity > 5;
SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Bar Tools' AND T1.`Order Quantity` > 5
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,615
2,615
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Order Quantity" INTEGER, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "AS", "AND", "SELECT", "SUM", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
List out the city name of states located in South region.
SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.Region = 'South' THEN T2.`City Name` END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,616
2,616
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( "City Name" TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT )
[ "AS", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 171, 672, 706 ], "case_2": [ 171, 672, 706 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
What is the region of stores which have type of "Town" in the list?
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.Type = 'Town' THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,617
2,617
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT, Type TEXT )
[ "AS", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 171, 672, 706 ], "case_2": [ 171, 672, 706 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many orders that Medsep Group had made?
Medsep Group is the name of the customer; orders refer to OrderNumber;
SELECT SUM(CASE WHEN T1.`Customer Names` = 'Medsep Group' THEN 1 ELSE 0 END) FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,618
2,618
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
List out the discount levels applied for all orders from Ole Group.
Ole Group is the name of the customer; discount levels applied refer to Discount Applied NOT NULL;
SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.`Customer Names` = 'Ole Group' THEN T2.`Discount Applied` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,619
2,619
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Discount Applied" REAL )
[ "AS", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
State the customer name of orders which has shipped date in 7/8/2018.
shipped date in 7/8/2018 refers to ShipDate = '7/8/18'
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.ShipDate = '7/8/18' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,620
2,620
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( ShipDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "AS", "SELECT", "/", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
13
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 126, 153, 219, 258, 747, 844 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 837, 844, 880, 909, 912, 944, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 7, 16, 24, 42, 53, 64, 71, 77, 81, 92, 97, 106, 113, 120, 126, 127, 129, 138, 148, 150, 152, 153, 155, 158, 171, 191, 195, 200, 201, 207, 212, 219, 225, 226, 227, 234, 236, 248, 258, 261, 263, 264, 267, 279, 298, 299, 300, 303, 304, 305, 322, 335, 341, 347, 360, 375, 383, 393, 395, 398, 402, 406, 412, 415, 427, 436, 438, 443, 452, 476, 478, 479, 486, 487, 493, 500, 508, 514, 516, 518, 522, 528, 533, 535, 540, 547, 550, 563, 564, 571, 573, 575, 580, 581, 589, 601, 620, 623, 628, 636, 637, 640, 646, 649, 662, 666, 672, 676, 682, 686, 706, 710, 712, 723, 724, 740, 744, 747, 753, 754, 762, 772, 776, 787, 788, 796, 800, 805, 806, 808, 813, 827, 837, 841, 844, 848, 868, 871, 874, 880, 894, 896, 909, 912, 922, 924, 926, 927, 935, 941, 943, 944, 959, 978, 982, 985, 1012, 1036, 1042, 1048, 1062, 1064, 1066, 1069, 1078, 1082, 1087, 1092, 1098, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
Among the orders placed by Ei, how many orders have quantity greater than 4?
Ei is the name of the customer; orders have quantity greater than 4 refer to OrderNumber WHERE Order Quantity > 4;
SELECT SUM(CASE WHEN T1.`Order Quantity` > 4 AND T2.`Customer Names` = 'Ei ' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,621
2,621
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Order Quantity" INTEGER )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
10
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 362, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Among the orders placed by Pacific Ltd, how many orders have been applied 5% discount ?
orders by Pacific Ltd refer to OrderNumber where Customer Names = 'Pacific Ltd'; applied 5% discount refers to Discount Applied = 0.05;
SELECT SUM(CASE WHEN T1.`Discount Applied` = 0.05 AND T2.`Customer Names` = 'Pacific Ltd' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,622
2,622
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Discount Applied" REAL )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
10
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 362, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
What is the customer names of orders which have unit cost greater than 4000USD?
unit cost greater than 4000USD refers to Unit Cost > 4000;
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Unit Cost` > 4000 THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,623
2,623
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Unit Cost" TEXT )
[ "AS", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Please list the id and detailed position of all stores in Birmingham city.
Latitude and Longitude coordinates can be used to identify the detailed position of stores; id refers to StoreID;
SELECT StoreID, Latitude, Longitude FROM `Store Locations` WHERE `City Name` = 'Birmingham'
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,624
2,624
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, Latitude REAL, Longitude REAL )
[ "SELECT", "FROM" ]
2
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141 ] }
regional_sales
Which city has the largest population?
city has the largest population refers to City Name where MAX(Population);
SELECT `City Name` FROM `Store Locations` ORDER BY Population DESC LIMIT 1
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,625
2,625
CREATE TABLE `Store Locations` ( "City Name" TEXT, Population INTEGER )
[ "SELECT", "ORDER BY", "LIMIT", "FROM", "DESC" ]
5
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 17, 49, 202, 247, 263, 348, 394, 411, 708, 918, 975, 1077 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 1, 10, 11, 13, 15, 17, 20, 28, 29, 36, 38, 43, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 108, 110, 121, 125, 133, 138, 150, 159, 162, 163, 167, 173, 174, 179, 181, 185, 187, 188, 199, 200, 202, 206, 208, 213, 229, 233, 239, 247, 252, 262, 263, 275, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 328, 329, 334, 336, 337, 341, 342, 345, 348, 349, 352, 353, 356, 359, 364, 365, 371, 373, 378, 379, 381, 385, 394, 395, 400, 403, 404, 409, 411, 428, 429, 434, 435, 444, 445, 451, 454, 460, 462, 469, 482, 495, 497, 505, 530, 532, 534, 536, 538, 542, 548, 552, 555, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 634, 637, 638, 645, 654, 657, 659, 664, 665, 669, 681, 688, 690, 691, 698, 701, 703, 708, 713, 719, 732, 733, 735, 748, 752, 759, 760, 768, 778, 790, 803, 810, 815, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 876, 886, 889, 891, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 953, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 989, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1024, 1025, 1030, 1034, 1037, 1038, 1047, 1049, 1050, 1051, 1056, 1057, 1065, 1067, 1068, 1075, 1076, 1077, 1083, 1094, 1124, 1137, 1139, 1141 ] }
regional_sales
How many CDP stores are there in California?
California is a state; CDP stores refer to StoreID where Type = 'CDP';
SELECT SUM(CASE WHEN State = 'California' AND Type = 'CDP' THEN 1 ELSE 0 END) FROM `Store Locations`
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,626
2,626
CREATE TABLE `Store Locations` ( StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT )
[ "CASE WHEN", "AND", "SELECT", "SUM", "CASE", "FROM" ]
6
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 127, 129, 153, 158, 219, 258, 264, 305, 398, 438, 528, 601, 666, 744, 747, 832, 844, 909, 912, 944 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 39, 42, 54, 61, 64, 71, 77, 81, 93, 104, 106, 112, 113, 120, 122, 127, 129, 141, 148, 152, 153, 155, 158, 169, 173, 184, 191, 192, 195, 201, 205, 207, 212, 215, 219, 223, 225, 226, 234, 236, 245, 248, 258, 261, 264, 267, 271, 279, 299, 300, 304, 305, 317, 322, 335, 347, 350, 356, 360, 362, 375, 383, 393, 398, 402, 406, 412, 415, 423, 427, 438, 448, 452, 453, 458, 470, 476, 478, 485, 486, 500, 504, 508, 510, 514, 517, 518, 528, 535, 537, 540, 547, 550, 563, 564, 571, 573, 575, 580, 581, 601, 612, 620, 623, 628, 640, 646, 662, 666, 676, 682, 686, 690, 709, 710, 723, 740, 744, 747, 753, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 808, 810, 825, 827, 832, 841, 844, 848, 868, 870, 871, 872, 874, 896, 909, 912, 922, 924, 926, 939, 943, 944, 958, 959, 979, 985, 998, 1008, 1012, 1023, 1027, 1031, 1036, 1048, 1062, 1064, 1068, 1069, 1078, 1082, 1087, 1092, 1093, 1098, 1100, 1110, 1121, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
Please give the order number and product name of the order which has the lowest unit price.
the lowest unit price refers to MIN(Unit Price);
SELECT T1.OrderNumber, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE REPLACE(T1.`Unit Price`, ',', '') = ( SELECT REPLACE(T1.`Unit Price`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') LIMIT 1 )
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,627
2,627
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "FROM" ]
14
medium
{ "case_1": [ 202, 438, 724, 832, 837, 880 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 713, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 989, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1024, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1075, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
Which product has the highest net profit in 2019?
net profit can be computed as SUBTRACT(Unit Price, Unit Cost); the highest net profit in 2019 refers to MAX(Net Profit) where OrderDate LIKE '%/19'; product refers to Product Name;
SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.OrderDate LIKE '%/%/19' ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,628
2,628
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "AS", "SELECT", "LIKE", "LIMIT", "ORDER BY", "INNER JOIN", "ON", "DESC", "FROM" ]
10
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
What is the average unit price of a Cookware product?
AVG(Unit Price where Product Name = 'Cookware');
SELECT AVG(REPLACE(T1.`Unit Price`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Cookware'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,629
2,629
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT )
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
7
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Please list all sale team names which had orders on 5/31/2018.
had orders on 5/31/2018 refer to OrderDate = '5/31/18'; sale team names refer to Sales Team;
SELECT T FROM ( SELECT DISTINCT CASE WHEN T1.OrderDate = '5/31/18' THEN T2.`Sales Team` ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN `Sales Team` T2 ON T2.SalesTeamID = T1._SalesTeamID ) WHERE T IS NOT NULL
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,630
2,630
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "AS", "SELECT", "/", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
14
medium
{ "case_1": [ 298, 912, 1066 ], "case_2": [ 298, 912, 1066 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 837, 844, 880, 909, 912, 944, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 7, 16, 24, 42, 53, 64, 71, 77, 81, 92, 97, 106, 113, 120, 126, 127, 129, 138, 148, 150, 152, 153, 155, 158, 171, 191, 195, 200, 201, 207, 212, 219, 225, 226, 227, 234, 236, 248, 258, 261, 263, 264, 267, 279, 298, 299, 300, 303, 304, 305, 322, 335, 341, 347, 360, 375, 383, 393, 395, 398, 402, 406, 412, 415, 427, 436, 438, 443, 452, 476, 478, 479, 486, 487, 493, 500, 508, 514, 516, 518, 522, 528, 533, 535, 540, 547, 550, 563, 564, 571, 573, 575, 580, 581, 589, 601, 620, 623, 628, 636, 637, 640, 646, 649, 662, 666, 672, 676, 682, 686, 706, 710, 712, 723, 724, 740, 744, 747, 753, 754, 762, 772, 776, 787, 788, 796, 800, 805, 806, 808, 813, 827, 837, 841, 844, 848, 868, 871, 874, 880, 894, 896, 909, 912, 922, 924, 926, 927, 935, 941, 943, 944, 959, 978, 982, 985, 1012, 1036, 1042, 1048, 1062, 1064, 1066, 1069, 1078, 1082, 1087, 1092, 1098, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
Which sales team name has the least orders in 2019?
sale team names refer to Sales Team; the least orders in 2019 refer to MIN(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '19'));
SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) ASC LIMIT 1
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,631
2,631
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "GROUP BY", "AS", "SELECT", "LIKE", "LIMIT", "ORDER BY", "INNER JOIN", "ON", "ASC", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 247, 912, 918 ], "case_2": [ 247, 912, 918, 1128 ], "case_3": [ 49, 126, 127, 202, 247, 258, 264, 348, 394, 411, 438, 666, 747, 832, 844, 909, 912, 918, 944, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 6, 11, 13, 15, 16, 20, 22, 26, 27, 28, 29, 30, 36, 37, 47, 49, 51, 53, 55, 57, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 81, 82, 86, 88, 89, 90, 91, 93, 96, 98, 106, 108, 113, 115, 117, 118, 119, 121, 125, 126, 127, 131, 136, 138, 140, 142, 143, 146, 148, 150, 152, 159, 160, 162, 163, 164, 167, 169, 170, 173, 175, 179, 183, 184, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 229, 233, 234, 239, 240, 243, 244, 247, 252, 254, 256, 258, 261, 262, 264, 267, 268, 269, 275, 276, 277, 278, 281, 286, 299, 301, 309, 311, 313, 314, 315, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 394, 395, 401, 402, 403, 406, 407, 409, 411, 412, 415, 416, 417, 424, 426, 428, 429, 430, 433, 434, 435, 436, 438, 444, 445, 448, 451, 452, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 490, 493, 495, 497, 500, 505, 509, 515, 516, 519, 520, 526, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 552, 557, 558, 559, 560, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 624, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 657, 658, 659, 662, 663, 664, 665, 666, 668, 669, 671, 675, 681, 687, 688, 690, 691, 694, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 747, 748, 749, 750, 751, 752, 753, 754, 756, 759, 760, 762, 768, 769, 772, 774, 778, 779, 787, 790, 796, 797, 799, 800, 802, 803, 804, 810, 812, 813, 814, 818, 819, 823, 824, 827, 828, 830, 832, 838, 839, 841, 844, 849, 850, 851, 853, 857, 858, 861, 866, 867, 869, 870, 874, 875, 876, 877, 879, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 907, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 943, 944, 950, 951, 953, 954, 956, 958, 961, 962, 963, 966, 967, 969, 970, 972, 973, 975, 977, 980, 981, 985, 986, 993, 994, 996, 1000, 1005, 1006, 1010, 1013, 1015, 1017, 1019, 1022, 1023, 1025, 1030, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1070, 1071, 1072, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1111, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
From 2018 to 2020, which year did the George Lewis group have the highest number of orders?
George Lewis refers to Sales Team; the highest number of orders refers to MAX(COUNT(OrderNumber)); which year from 2018 to 2020 refers to SUBSTR(OrderDate, -2) IN ('18', '19', '20') GROUP BY SUBSTR(OrderDate, -2);
SELECT SUBSTR(T1.OrderDate, -2, 2) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'George Lewis' GROUP BY SUBSTR(T1.OrderDate, -2, 2) ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,632
2,632
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "SUBSTR", "COUNT", "FROM" ]
13
medium
{ "case_1": [ 247, 912, 918 ], "case_2": [ 247, 912, 918, 1128 ], "case_3": [ 49, 126, 202, 219, 247, 348, 394, 411, 909, 912, 918, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 4, 6, 10, 11, 13, 15, 16, 20, 22, 27, 28, 29, 30, 36, 37, 47, 49, 51, 53, 55, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 82, 86, 88, 89, 91, 93, 96, 98, 106, 108, 113, 115, 117, 118, 119, 121, 125, 126, 131, 138, 140, 142, 143, 146, 148, 150, 152, 159, 160, 162, 163, 164, 167, 169, 170, 173, 175, 179, 183, 184, 185, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 219, 225, 226, 227, 229, 233, 234, 239, 243, 244, 247, 252, 254, 256, 261, 262, 267, 268, 269, 275, 276, 277, 278, 281, 285, 286, 291, 299, 301, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 394, 395, 401, 403, 406, 409, 411, 412, 416, 417, 424, 426, 428, 429, 434, 435, 436, 444, 445, 448, 451, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 490, 493, 495, 497, 500, 505, 509, 515, 516, 519, 520, 526, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 552, 558, 559, 560, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 657, 658, 659, 662, 663, 664, 665, 668, 669, 671, 681, 687, 688, 690, 691, 694, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 748, 749, 750, 751, 752, 753, 756, 759, 760, 762, 768, 769, 772, 778, 779, 787, 790, 796, 797, 799, 800, 802, 803, 804, 810, 812, 813, 814, 818, 819, 823, 824, 827, 830, 838, 839, 841, 849, 850, 851, 853, 857, 861, 866, 867, 869, 870, 874, 876, 877, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 943, 950, 951, 953, 954, 956, 958, 961, 962, 963, 966, 967, 969, 970, 972, 973, 975, 977, 981, 983, 985, 986, 987, 993, 994, 996, 1004, 1005, 1006, 1010, 1013, 1015, 1017, 1022, 1023, 1025, 1030, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1071, 1072, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1100, 1101, 1103, 1104, 1106, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
What is the percentage of total orders from stores in Orange County in 2018?
DIVIDE(COUNT(OrderNumber where County = 'Orange County' and SUBSTR(OrderDate, -2) = '18'), COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18')) as percentage;
SELECT CAST(SUM(CASE WHEN T2.County = 'Orange County' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate LIKE '%/%/18'
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,633
2,633
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, County TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "CASE WHEN", "AS", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
13
medium
{ "case_1": [ 127, 129, 158, 394, 479, 666, 909, 944, 975 ], "case_2": [ 127, 129, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 528, 666, 672, 706, 744, 747, 805, 832, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 6, 11, 16, 20, 22, 24, 26, 27, 30, 35, 36, 37, 39, 42, 47, 51, 53, 55, 57, 59, 61, 62, 63, 64, 68, 69, 71, 73, 74, 75, 77, 81, 82, 83, 86, 87, 88, 90, 91, 93, 94, 96, 98, 104, 106, 112, 113, 115, 117, 118, 119, 120, 121, 125, 126, 127, 129, 131, 136, 140, 141, 142, 143, 146, 148, 152, 153, 155, 158, 159, 160, 164, 167, 169, 170, 171, 173, 175, 179, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 196, 197, 199, 201, 202, 206, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 229, 233, 234, 236, 240, 243, 244, 247, 248, 254, 256, 258, 261, 264, 267, 268, 269, 271, 276, 277, 278, 279, 298, 299, 300, 301, 304, 311, 313, 314, 315, 316, 317, 319, 320, 322, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 347, 349, 354, 356, 358, 360, 363, 364, 365, 370, 373, 374, 375, 378, 379, 381, 382, 383, 384, 391, 392, 393, 394, 398, 401, 402, 403, 406, 407, 409, 411, 412, 415, 416, 417, 423, 424, 426, 427, 430, 433, 436, 438, 444, 445, 448, 450, 451, 452, 453, 454, 458, 460, 462, 464, 465, 467, 469, 470, 471, 473, 476, 477, 478, 479, 483, 484, 485, 486, 487, 488, 490, 493, 500, 504, 505, 509, 510, 514, 515, 516, 517, 518, 519, 520, 526, 528, 532, 535, 536, 537, 538, 540, 544, 547, 548, 550, 552, 557, 558, 559, 560, 563, 564, 566, 571, 573, 575, 579, 580, 581, 582, 595, 596, 597, 606, 608, 609, 611, 612, 613, 620, 623, 624, 627, 628, 630, 632, 633, 634, 638, 640, 641, 645, 646, 649, 650, 654, 658, 659, 662, 663, 665, 666, 668, 669, 671, 672, 675, 676, 681, 682, 686, 687, 688, 690, 694, 695, 696, 701, 705, 706, 710, 712, 714, 717, 721, 723, 727, 733, 734, 735, 736, 739, 740, 743, 744, 745, 747, 749, 750, 752, 753, 754, 756, 760, 762, 768, 769, 772, 774, 776, 777, 778, 779, 787, 788, 790, 795, 796, 797, 798, 799, 800, 802, 804, 805, 808, 810, 812, 813, 814, 818, 819, 823, 824, 825, 827, 828, 830, 832, 838, 839, 841, 844, 848, 849, 850, 851, 853, 857, 858, 866, 867, 868, 870, 871, 874, 875, 876, 877, 879, 880, 886, 888, 893, 894, 896, 897, 898, 901, 902, 907, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 930, 934, 935, 941, 943, 944, 950, 951, 954, 956, 958, 959, 961, 962, 963, 969, 973, 975, 977, 979, 980, 981, 985, 986, 993, 996, 998, 1000, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1019, 1022, 1023, 1027, 1031, 1037, 1038, 1042, 1043, 1047, 1050, 1051, 1058, 1062, 1064, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1078, 1082, 1084, 1086, 1087, 1092, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1111, 1112, 1119, 1121, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
Which order number has the highest unit price?
the highest unit price refers to MAX(Unit Price);
SELECT OrderNumber FROM `Sales Orders` WHERE REPLACE(`Unit Price`, ',', '') = ( SELECT REPLACE(`Unit Price`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1 )
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,634
2,634
CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Unit Price" TEXT )
[ "SELECT", "ORDER BY", "LIMIT", "FROM", "DESC" ]
7
simple
{ "case_1": [ 17, 348, 708 ], "case_2": [ 17, 348, 708 ], "case_3": [ 17, 49, 202, 247, 263, 348, 394, 411, 708, 918, 975, 1077 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 1, 10, 11, 13, 15, 17, 20, 28, 29, 36, 38, 43, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 108, 110, 121, 125, 133, 138, 150, 159, 162, 163, 167, 173, 174, 179, 181, 185, 187, 188, 199, 200, 202, 206, 208, 213, 229, 233, 239, 247, 252, 262, 263, 275, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 328, 329, 334, 336, 337, 341, 342, 345, 348, 349, 352, 353, 356, 359, 364, 365, 371, 373, 378, 379, 381, 385, 394, 395, 400, 403, 404, 409, 411, 428, 429, 434, 435, 444, 445, 451, 454, 460, 462, 469, 482, 495, 497, 505, 530, 532, 534, 536, 538, 542, 548, 552, 555, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 634, 637, 638, 645, 654, 657, 659, 664, 665, 669, 681, 688, 690, 691, 698, 701, 703, 708, 713, 719, 732, 733, 735, 748, 752, 759, 760, 768, 778, 790, 803, 810, 815, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 876, 886, 889, 891, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 953, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 989, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1024, 1025, 1030, 1034, 1037, 1038, 1047, 1049, 1050, 1051, 1056, 1057, 1065, 1067, 1068, 1075, 1076, 1077, 1083, 1094, 1124, 1137, 1139, 1141 ] }
regional_sales
Which sales team id has the highest number of orders in 2018?
the highest number of orders in 2018 refers to MAX(COUNT(OrderNumber where SUBSTR(OrderDate, -2) = '18'));
SELECT _SalesTeamID FROM `Sales Orders` WHERE OrderDate LIKE '%/%/18' GROUP BY _SalesTeamID ORDER BY COUNT(_SalesTeamID) DESC LIMIT 1
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,635
2,635
CREATE TABLE `Sales Orders` ( OrderDate TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "GROUP BY", "SELECT", "LIKE", "LIMIT", "ORDER BY", "DESC", "COUNT", "FROM" ]
8
simple
{ "case_1": [ 17, 348, 708 ], "case_2": [ 17, 348, 708 ], "case_3": [ 17, 49, 126, 202, 247, 263, 348, 394, 411, 708, 918, 975, 1077 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 1, 10, 11, 13, 15, 17, 20, 28, 29, 36, 38, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 108, 121, 125, 126, 133, 159, 162, 163, 167, 173, 174, 179, 181, 185, 187, 188, 199, 202, 206, 208, 213, 229, 233, 247, 252, 262, 263, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 329, 334, 336, 337, 341, 345, 348, 349, 352, 356, 359, 364, 365, 371, 373, 378, 379, 381, 394, 400, 403, 404, 409, 411, 429, 434, 435, 444, 445, 451, 454, 460, 462, 469, 482, 495, 497, 505, 530, 532, 534, 536, 538, 542, 548, 552, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 634, 638, 645, 654, 657, 659, 664, 665, 669, 681, 688, 690, 691, 698, 701, 703, 708, 719, 732, 733, 735, 743, 748, 752, 759, 760, 768, 778, 790, 810, 815, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 876, 886, 889, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1025, 1030, 1034, 1037, 1038, 1047, 1049, 1050, 1051, 1056, 1057, 1067, 1070, 1076, 1077, 1083, 1094, 1124, 1137, 1139, 1141 ] }
regional_sales
What is the unit cost of order SO - 000103?
OrderNumber = 'SO - 000103';
SELECT DISTINCT T FROM ( SELECT IIF(OrderNumber = 'SO - 000103', `Unit Cost`, NULL) AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,636
2,636
CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Unit Cost" TEXT )
[ "AS", "SELECT", "NULL", "NOT", "IS", "FROM" ]
9
simple
{ "case_1": [ 92 ], "case_2": [ 92, 601 ], "case_3": [ 92, 126, 158, 171, 258, 263, 298, 303, 305, 398, 443, 479, 528, 601, 672, 706, 724, 805, 837, 844, 880, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 7, 16, 42, 53, 67, 92, 106, 126, 138, 148, 150, 152, 158, 171, 195, 200, 258, 263, 267, 294, 298, 299, 303, 305, 375, 393, 395, 398, 402, 406, 423, 436, 443, 458, 476, 478, 479, 485, 493, 508, 514, 516, 522, 528, 533, 573, 589, 601, 620, 637, 646, 672, 706, 712, 724, 772, 805, 837, 844, 880, 894, 926, 927, 935, 941, 965, 978, 982, 985, 1014, 1020, 1036, 1048, 1059, 1062, 1066, 1069, 1129, 1131, 1133, 1134 ] }
regional_sales
In 2020, what were the total orders of all stores in Maricopa County?
total orders refer to COUNT(OrderNumber); 2020 refers to SUBSTR(OrderDate, -2) = '20';
SELECT SUM(CASE WHEN T2.County = 'Maricopa County' AND OrderDate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,637
2,637
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, County TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "FROM" ]
11
medium
{ "case_1": [ 127, 129, 158, 479, 666, 909, 944 ], "case_2": [ 127, 129, 158, 479, 666, 909, 944 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 918, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 4, 5, 6, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 59, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 81, 82, 83, 85, 88, 90, 93, 94, 95, 96, 98, 99, 104, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 136, 138, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 200, 201, 202, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 247, 248, 254, 256, 258, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 304, 313, 314, 315, 316, 317, 319, 322, 323, 325, 330, 335, 339, 341, 347, 356, 360, 361, 363, 365, 368, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 407, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 430, 433, 436, 437, 438, 440, 444, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 483, 486, 487, 488, 490, 493, 494, 496, 497, 498, 500, 504, 507, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 605, 608, 609, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 630, 632, 633, 637, 638, 640, 641, 643, 646, 648, 650, 651, 658, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 706, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 774, 775, 776, 777, 780, 783, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 819, 823, 824, 825, 827, 828, 829, 830, 832, 835, 838, 841, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 875, 877, 878, 879, 880, 886, 888, 892, 895, 896, 902, 905, 907, 909, 912, 917, 918, 922, 923, 924, 926, 928, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 979, 980, 985, 986, 991, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1058, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1128, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
What is the detailed position of the store which has order SO - 000115?
Latitude and Longitude coordinates can be used to identify the detailed position of stores; store refers to StoreID WHERE OrderNumber = 'SO - 000115';
SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderNumber = 'SO - 000115'
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,638
2,638
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, Latitude REAL, Longitude REAL ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ 139 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1075, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Please calculate the total number of orders by each city in 2019.
total number of orders refers to COUNT(OrderNumber); 2019 refers to OrderDate between 01-01-2019 and 31-12-2019; city refers to City Name;
SELECT COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate LIKE '%/%/19' GROUP BY T2.`City Name` HAVING COUNT(T1.OrderNumber)
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,639
2,639
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "GROUP BY", "AS", "SELECT", "HAVING", "LIKE", "INNER JOIN", "ON", "COUNT", "FROM" ]
11
medium
{ "case_1": [ 127, 129, 158, 394, 479, 666, 909, 944, 975 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 182, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 718, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 817, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Please list the names of customers who have total orders of over 3 in 2018.
total orders of over 3 in 2018 refer to COUNT(OrderNumber) > 3 where SUBSTR(OrderDate, -2) = '18';
SELECT DISTINCT IIF(COUNT(T2.CustomerID) > 3, T2.`Customer Names`, NULL) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T1.OrderDate LIKE '%/%/18' GROUP BY T1._CustomerID HAVING COUNT(T2.CustomerID)
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,640
2,640
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "GROUP BY", "AS", "SELECT", "HAVING", "LIKE", "NULL", "INNER JOIN", "ON", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 126, 258, 747, 844 ], "case_2": [ 126, 258, 747, 844 ], "case_3": [ 126, 127, 158, 171, 202, 247, 258, 264, 298, 394, 398, 411, 438, 479, 528, 666, 672, 706, 724, 747, 805, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 6, 11, 16, 20, 22, 26, 27, 30, 36, 37, 42, 47, 51, 53, 55, 57, 59, 62, 63, 68, 69, 73, 74, 75, 77, 81, 82, 86, 88, 90, 91, 93, 96, 98, 106, 113, 115, 117, 118, 119, 121, 125, 126, 127, 131, 136, 138, 140, 142, 143, 146, 148, 150, 152, 158, 159, 160, 164, 167, 169, 170, 171, 175, 179, 183, 184, 187, 188, 189, 190, 191, 195, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 229, 233, 234, 240, 243, 244, 247, 254, 256, 258, 261, 264, 267, 268, 269, 276, 277, 298, 299, 301, 311, 313, 314, 315, 316, 317, 319, 320, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 349, 354, 356, 358, 360, 364, 365, 370, 373, 374, 375, 378, 379, 381, 382, 383, 384, 391, 392, 393, 394, 395, 398, 401, 402, 403, 406, 407, 409, 411, 412, 415, 416, 417, 424, 426, 430, 433, 436, 438, 444, 445, 448, 452, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 479, 484, 487, 488, 490, 493, 500, 505, 509, 514, 515, 516, 519, 520, 522, 526, 528, 532, 533, 535, 536, 537, 538, 544, 547, 548, 552, 557, 558, 559, 560, 563, 564, 566, 573, 579, 580, 581, 582, 586, 589, 595, 596, 597, 606, 608, 611, 613, 620, 624, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 658, 659, 662, 663, 665, 666, 668, 669, 671, 672, 675, 681, 687, 688, 690, 694, 696, 701, 705, 706, 712, 714, 720, 721, 724, 727, 733, 734, 735, 736, 739, 740, 743, 747, 749, 750, 751, 752, 753, 754, 756, 760, 762, 768, 769, 772, 774, 778, 779, 787, 790, 796, 797, 799, 800, 802, 804, 805, 810, 812, 813, 814, 818, 819, 823, 824, 827, 828, 830, 832, 837, 838, 839, 841, 844, 849, 850, 851, 853, 857, 858, 866, 867, 870, 874, 875, 876, 877, 879, 880, 882, 886, 888, 889, 893, 894, 896, 897, 898, 901, 902, 907, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 930, 932, 934, 935, 941, 943, 944, 950, 951, 954, 956, 958, 961, 962, 963, 969, 973, 975, 977, 980, 981, 985, 986, 993, 996, 1000, 1005, 1006, 1010, 1013, 1015, 1019, 1022, 1023, 1025, 1037, 1042, 1043, 1047, 1050, 1051, 1058, 1062, 1064, 1066, 1067, 1070, 1071, 1072, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1111, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
What were the total orders of Medsep Group from 2018 to 2020?
Medsep Group is the name of the customer; total orders refer to COUNT(OrderNumber); from 2018 to 2020 refers to SUBSTR(OrderDate, -2) IN ('18', '19', '20');
SELECT SUM(CASE WHEN SUBSTR(T1.OrderDate, -2) IN ('18', '19', '20') AND T2.`Customer Names` = 'Medsep Group' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,641
2,641
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "CASE", "INNER JOIN", "IN", "ON", "SUBSTR", "FROM" ]
12
medium
{ "case_1": [ 219, 258, 747, 844 ], "case_2": [ 153, 219, 258, 747, 844 ], "case_3": [ 127, 129, 153, 158, 171, 219, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 4, 5, 6, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 54, 57, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 81, 83, 85, 88, 90, 93, 94, 95, 96, 98, 99, 104, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 122, 125, 127, 128, 129, 131, 138, 140, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 166, 169, 170, 171, 172, 175, 176, 177, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 200, 201, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 248, 254, 256, 258, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 304, 313, 314, 315, 316, 317, 319, 322, 323, 325, 330, 335, 339, 341, 347, 356, 360, 361, 363, 365, 368, 370, 374, 375, 376, 378, 379, 381, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 444, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 483, 486, 487, 488, 490, 493, 494, 496, 497, 498, 500, 504, 507, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 528, 529, 530, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 605, 608, 609, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 630, 632, 633, 637, 638, 640, 641, 643, 646, 648, 650, 651, 658, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 706, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 775, 776, 777, 780, 783, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 819, 823, 824, 825, 827, 829, 830, 832, 835, 838, 841, 844, 848, 849, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 872, 873, 874, 877, 878, 879, 880, 886, 888, 892, 895, 896, 902, 905, 907, 909, 912, 917, 922, 923, 924, 926, 928, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 985, 986, 991, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1058, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1115, 1119, 1123, 1128, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
Please list the customer names whose order quantity was more than 5 on 6/1/2018.
order quantity was more than 5 on 6/1/2018 refers to Order Quantity > 5 where OrderDate = 6/1/2018;
SELECT T FROM ( SELECT DISTINCT CASE WHEN SUM(T1.`Order Quantity`) > 5 THEN T2.`Customer Names` END AS T FROM `Sales Orders` T1 INNER JOIN Customers T2 ON T2.CustomerID = T1._CustomerID WHERE T1.OrderDate = '6/1/18' GROUP BY T1._CustomerID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,642
2,642
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Order Quantity" INTEGER )
[ "GROUP BY", "AS", "SELECT", "SUM", "/", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
15
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 126, 153, 219, 258, 747, 844 ], "case_3": [ 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 837, 844, 880, 909, 912, 944, 978, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 42, 53, 64, 71, 77, 81, 106, 113, 120, 126, 127, 129, 138, 148, 150, 152, 153, 155, 158, 169, 171, 191, 195, 200, 201, 207, 212, 213, 219, 225, 226, 234, 236, 248, 258, 261, 263, 264, 267, 279, 298, 299, 300, 303, 304, 305, 313, 335, 341, 347, 356, 360, 365, 375, 378, 379, 381, 383, 393, 395, 398, 402, 406, 409, 412, 415, 427, 436, 438, 443, 452, 476, 478, 479, 486, 487, 493, 500, 508, 514, 516, 518, 522, 528, 533, 535, 540, 547, 550, 563, 564, 571, 573, 575, 579, 580, 581, 589, 601, 620, 623, 628, 630, 637, 638, 640, 646, 662, 666, 672, 676, 682, 686, 690, 701, 706, 710, 712, 723, 724, 740, 744, 747, 753, 762, 772, 776, 787, 788, 796, 800, 805, 808, 810, 813, 823, 827, 837, 841, 844, 848, 868, 871, 874, 880, 894, 896, 909, 912, 922, 924, 926, 927, 935, 941, 943, 944, 959, 962, 973, 978, 985, 1012, 1036, 1048, 1062, 1064, 1066, 1069, 1078, 1082, 1087, 1092, 1098, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
What is the percentage of total orders of Stephen Payne that had a net profit of over 1000?
Sales Team = 'Stephen Payne'; net profit can be computed as SUBTRACT(Unit Price, Unit Cost); DIVIDE(COUNT(OrderNumber where Sales Team = 'Stephen Payne' and Net Profit > 1000)), (COUNT(OrderNumber where Sales Team = 'Stephen Payne')) as percentage;
SELECT CAST(SUM(CASE WHEN REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') > 1000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.`Sales Team` = 'Stephen Payne'
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,643
2,643
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 247, 298, 912, 918, 1066 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 528, 666, 672, 706, 744, 747, 805, 832, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 4, 6, 11, 16, 22, 24, 27, 30, 35, 36, 37, 39, 42, 47, 51, 53, 55, 61, 62, 63, 64, 68, 69, 71, 73, 74, 75, 77, 81, 82, 83, 86, 87, 88, 91, 93, 94, 96, 98, 104, 106, 112, 113, 115, 117, 118, 119, 120, 121, 125, 126, 127, 129, 131, 140, 141, 142, 143, 146, 148, 152, 153, 155, 158, 159, 160, 164, 167, 169, 170, 171, 173, 175, 179, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 196, 197, 199, 201, 202, 206, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 229, 233, 234, 236, 243, 244, 247, 248, 254, 256, 258, 261, 264, 267, 268, 269, 271, 276, 277, 278, 279, 298, 299, 300, 301, 304, 311, 313, 314, 316, 317, 319, 320, 322, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 347, 349, 354, 356, 358, 360, 363, 364, 365, 370, 373, 374, 375, 378, 379, 381, 382, 383, 384, 391, 392, 393, 394, 398, 401, 402, 403, 406, 409, 411, 412, 415, 416, 417, 423, 424, 426, 427, 436, 438, 444, 445, 448, 450, 451, 452, 453, 454, 458, 460, 462, 464, 465, 467, 469, 470, 471, 473, 476, 477, 478, 479, 483, 484, 485, 486, 487, 488, 490, 493, 500, 504, 505, 509, 510, 514, 515, 516, 517, 518, 519, 520, 526, 528, 532, 535, 536, 537, 538, 540, 544, 547, 548, 550, 552, 558, 559, 560, 563, 564, 566, 571, 573, 575, 579, 580, 581, 582, 595, 596, 597, 606, 608, 609, 611, 612, 613, 620, 623, 627, 628, 630, 632, 633, 634, 638, 640, 641, 645, 646, 649, 650, 654, 658, 659, 662, 663, 665, 666, 668, 669, 671, 672, 676, 681, 682, 686, 687, 688, 690, 694, 695, 696, 701, 705, 706, 710, 712, 714, 717, 721, 723, 727, 733, 734, 735, 736, 739, 740, 743, 744, 745, 747, 749, 750, 752, 753, 756, 760, 762, 768, 769, 772, 776, 777, 778, 779, 787, 788, 790, 795, 796, 797, 798, 799, 800, 802, 804, 805, 808, 810, 812, 813, 814, 818, 819, 823, 824, 825, 827, 830, 832, 838, 839, 841, 844, 848, 849, 851, 853, 857, 866, 867, 868, 870, 871, 874, 876, 877, 880, 886, 888, 893, 894, 896, 897, 898, 901, 902, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 930, 934, 935, 941, 943, 944, 950, 951, 954, 956, 958, 959, 961, 962, 963, 969, 973, 975, 977, 981, 985, 986, 993, 996, 998, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1022, 1023, 1027, 1031, 1037, 1038, 1042, 1043, 1047, 1050, 1051, 1058, 1062, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1082, 1084, 1086, 1087, 1092, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1112, 1119, 1121, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
How many sales team were from Northeast?
Northeast is the name of the region;
SELECT SUM(CASE WHEN Region = 'Northeast' THEN 1 ELSE 0 END) FROM `Sales Team`
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,644
2,644
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT )
[ "CASE WHEN", "SELECT", "SUM", "CASE", "FROM" ]
5
simple
{ "case_1": [ 978 ], "case_2": [ 978 ], "case_3": [ 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 744, 747, 805, 832, 844, 880, 909, 912, 944, 978, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 35, 39, 42, 54, 61, 64, 71, 77, 81, 83, 87, 93, 94, 104, 106, 112, 113, 120, 122, 127, 129, 141, 148, 152, 153, 155, 158, 169, 171, 173, 184, 186, 189, 191, 192, 195, 201, 205, 207, 212, 213, 215, 219, 223, 225, 226, 228, 234, 236, 245, 248, 254, 258, 261, 263, 264, 267, 271, 279, 285, 298, 299, 300, 303, 304, 305, 313, 316, 317, 322, 323, 335, 347, 350, 356, 360, 362, 363, 365, 375, 378, 379, 381, 383, 393, 398, 402, 406, 409, 412, 415, 423, 427, 438, 443, 448, 450, 452, 453, 458, 470, 476, 478, 479, 483, 485, 486, 487, 488, 500, 504, 506, 508, 510, 514, 517, 518, 527, 528, 535, 537, 540, 547, 550, 563, 564, 571, 573, 575, 579, 580, 581, 597, 601, 609, 612, 620, 623, 628, 630, 638, 640, 646, 650, 658, 662, 666, 672, 676, 682, 686, 690, 695, 701, 706, 709, 710, 717, 723, 740, 744, 745, 747, 750, 753, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 802, 805, 808, 810, 813, 823, 825, 827, 832, 841, 844, 848, 868, 870, 871, 872, 874, 880, 894, 896, 909, 912, 913, 922, 924, 926, 929, 939, 941, 943, 944, 958, 959, 962, 973, 978, 979, 985, 987, 998, 1008, 1012, 1023, 1027, 1031, 1036, 1038, 1048, 1062, 1064, 1066, 1068, 1069, 1078, 1082, 1087, 1092, 1093, 1098, 1100, 1110, 1121, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
State the name of all city in Maricopa County along with its latitude and longitude.
SELECT DISTINCT `City Name`, Latitude, Longitude FROM `Store Locations` WHERE County = 'Maricopa County'
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,645
2,645
CREATE TABLE `Store Locations` ( "City Name" TEXT, County TEXT, Latitude REAL, Longitude REAL )
[ "SELECT", "FROM" ]
2
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141 ] }
regional_sales
Which order have the highest unit cost?
order have the highest unit cost refers to OrderNumber where MAX(Unit Cost);
SELECT OrderNumber FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 )
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,646
2,646
CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Unit Cost" TEXT )
[ "SELECT", "ORDER BY", "LIMIT", "FROM", "DESC" ]
7
simple
{ "case_1": [ 17, 348, 708 ], "case_2": [ 17, 348, 708 ], "case_3": [ 17, 49, 202, 247, 263, 348, 394, 411, 708, 918, 975, 1077 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 1, 10, 11, 13, 15, 17, 20, 28, 29, 36, 38, 43, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 108, 110, 121, 125, 133, 138, 150, 159, 162, 163, 167, 173, 174, 179, 181, 185, 187, 188, 199, 200, 202, 206, 208, 213, 229, 233, 239, 247, 252, 262, 263, 275, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 328, 329, 334, 336, 337, 341, 342, 345, 348, 349, 352, 353, 356, 359, 364, 365, 371, 373, 378, 379, 381, 385, 394, 395, 400, 403, 404, 409, 411, 428, 429, 434, 435, 444, 445, 451, 454, 460, 462, 469, 482, 495, 497, 505, 530, 532, 534, 536, 538, 542, 548, 552, 555, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 634, 637, 638, 645, 654, 657, 659, 664, 665, 669, 681, 688, 690, 691, 698, 701, 703, 708, 713, 719, 732, 733, 735, 748, 752, 759, 760, 768, 778, 790, 803, 810, 815, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 876, 886, 889, 891, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 953, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 989, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1024, 1025, 1030, 1034, 1037, 1038, 1047, 1049, 1050, 1051, 1056, 1057, 1065, 1067, 1068, 1075, 1076, 1077, 1083, 1094, 1124, 1137, 1139, 1141 ] }
regional_sales
List all the name of products with the ID of 30 to 40.
products with the ID of 30 to 40 refer to Product Name WHERE ProductID BETWEEN 30 AND 40;
SELECT T FROM ( SELECT CASE WHEN ProductID BETWEEN 30 AND 40 THEN `Product Name` ELSE NULL END AS T FROM Products ) WHERE T IS NOT NULL
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,647
2,647
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT )
[ "AS", "AND", "SELECT", "BETWEEN", "CASE", "NULL", "NOT", "IS", "FROM" ]
12
medium
{ "case_1": [ 263, 305 ], "case_2": [ 263, 305 ], "case_3": [ 92, 127, 129, 158, 171, 219, 258, 263, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 747, 805, 837, 844, 880, 944, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 2, 10, 16, 24, 39, 42, 53, 67, 71, 74, 76, 92, 93, 98, 106, 113, 127, 129, 138, 148, 150, 152, 158, 171, 187, 195, 200, 219, 223, 256, 258, 263, 267, 294, 298, 299, 303, 305, 319, 325, 339, 375, 383, 393, 395, 398, 402, 403, 406, 423, 427, 436, 438, 443, 444, 451, 452, 458, 463, 476, 478, 479, 482, 485, 493, 500, 508, 514, 516, 522, 528, 530, 533, 544, 559, 562, 563, 573, 581, 589, 601, 620, 637, 646, 666, 672, 677, 686, 706, 712, 724, 740, 747, 753, 772, 776, 777, 788, 798, 800, 805, 808, 810, 837, 844, 848, 849, 880, 894, 896, 917, 924, 926, 927, 935, 941, 944, 954, 965, 978, 982, 985, 998, 1008, 1014, 1020, 1036, 1048, 1059, 1062, 1064, 1066, 1067, 1069, 1092, 1123, 1129, 1131, 1133, 1134 ] }
regional_sales
Calculate ratio between the highest unit cost and the lowest unit cost?
ratio can be calculated as DIVIDE(MAX(Unit_Cost)), MIN(Unit Cost);
SELECT ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Cost`, ',', '') DESC LIMIT 1 ) / ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` WHERE REPLACE(`Unit Cost`, ',', '') = ( SELECT REPLACE(`Unit Cost`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Cost`, ',', '') ASC LIMIT 1 ) ORDER BY REPLACE(`Unit Cost`, ',', '') ASC LIMIT 1 )
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,648
2,648
CREATE TABLE `Sales Orders` ( "Unit Cost" TEXT )
[ "SELECT", "ORDER BY", "LIMIT", "ASC", "DESC", "FROM" ]
21
challenging
{ "case_1": [ -1 ], "case_2": [ 17, 348, 708 ], "case_3": [ 17, 49, 202, 247, 263, 348, 394, 411, 708, 918, 975, 1077 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 1, 10, 11, 13, 15, 17, 20, 28, 29, 36, 38, 43, 49, 55, 59, 62, 69, 73, 75, 78, 86, 89, 108, 121, 125, 133, 138, 150, 159, 162, 163, 167, 173, 174, 179, 181, 185, 187, 188, 199, 202, 206, 208, 213, 229, 233, 247, 252, 262, 263, 275, 278, 281, 285, 286, 291, 309, 311, 313, 314, 319, 320, 324, 329, 334, 336, 337, 341, 342, 345, 348, 349, 352, 353, 356, 359, 364, 365, 371, 373, 378, 379, 381, 385, 394, 395, 400, 403, 404, 409, 411, 428, 429, 434, 435, 444, 445, 451, 454, 460, 462, 469, 482, 495, 497, 505, 530, 532, 534, 536, 538, 542, 548, 552, 555, 560, 566, 567, 576, 578, 579, 583, 584, 586, 590, 592, 595, 611, 619, 621, 625, 626, 634, 637, 638, 645, 654, 657, 659, 664, 665, 669, 681, 688, 690, 691, 698, 701, 703, 708, 713, 719, 732, 733, 735, 748, 752, 759, 760, 768, 778, 790, 803, 810, 815, 818, 823, 827, 830, 836, 850, 851, 861, 866, 869, 876, 886, 889, 891, 893, 901, 911, 918, 927, 929, 934, 946, 950, 951, 954, 956, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 983, 987, 989, 994, 1004, 1005, 1006, 1010, 1013, 1017, 1024, 1025, 1030, 1034, 1037, 1038, 1047, 1049, 1050, 1051, 1056, 1057, 1065, 1067, 1068, 1076, 1077, 1083, 1094, 1124, 1137, 1139, 1141 ] }
regional_sales
Which product was ordered the most in 2018?
product refers to Product Name; ordered the most in 2018 refers to MAX(COUNT(OrderNumber)) where SUBSTR(OrderDate, -2) = '18';
SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.OrderDate LIKE '%/%/18' GROUP BY T1._ProductID ORDER BY COUNT(T1._ProductID) DESC LIMIT 1
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,649
2,649
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "GROUP BY", "AS", "SELECT", "LIKE", "LIMIT", "ORDER BY", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 202, 438, 832 ], "case_2": [ 202, 438, 832 ], "case_3": [ 49, 126, 127, 202, 247, 258, 263, 264, 348, 394, 411, 438, 666, 747, 832, 844, 909, 912, 918, 944, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 6, 10, 11, 13, 15, 16, 20, 22, 26, 27, 28, 29, 30, 36, 37, 38, 47, 49, 51, 53, 55, 57, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 81, 82, 86, 88, 89, 90, 91, 93, 96, 98, 106, 108, 113, 115, 117, 118, 119, 121, 125, 126, 127, 131, 136, 138, 140, 142, 143, 146, 148, 150, 152, 159, 160, 162, 163, 164, 167, 169, 170, 173, 175, 179, 183, 184, 185, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 229, 233, 234, 239, 240, 243, 244, 247, 252, 254, 256, 258, 261, 262, 263, 264, 267, 268, 269, 275, 276, 277, 278, 281, 285, 286, 291, 299, 301, 309, 311, 313, 314, 315, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 394, 395, 401, 402, 403, 406, 407, 409, 411, 412, 415, 416, 417, 424, 426, 428, 429, 430, 433, 434, 435, 436, 438, 444, 445, 448, 451, 452, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 490, 493, 495, 497, 500, 505, 509, 515, 516, 519, 520, 526, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 552, 557, 558, 559, 560, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 624, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 657, 658, 659, 662, 663, 664, 665, 666, 668, 669, 671, 675, 681, 687, 688, 690, 691, 694, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 747, 748, 749, 750, 751, 752, 753, 754, 756, 759, 760, 762, 768, 769, 772, 774, 778, 779, 787, 790, 796, 797, 799, 800, 802, 803, 804, 810, 812, 813, 814, 818, 819, 823, 824, 827, 828, 830, 832, 838, 839, 841, 844, 849, 850, 851, 853, 857, 858, 861, 866, 867, 869, 870, 874, 875, 876, 877, 879, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 907, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 943, 944, 950, 951, 953, 954, 956, 958, 961, 962, 963, 966, 967, 969, 970, 972, 973, 975, 977, 980, 981, 983, 985, 986, 987, 993, 994, 996, 1000, 1004, 1005, 1006, 1010, 1013, 1015, 1017, 1019, 1022, 1023, 1025, 1030, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1070, 1071, 1072, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1111, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
How many products sold by Adam Hernandez?
products sold by Adam Hernandez refer to SUM(Order Quantity where Sales Team = 'Adam Hernandez');
SELECT SUM(CASE WHEN T2.`Sales Team` = 'Adam Hernandez' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,650
2,650
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
List all orders where its products were shipped from Daly City.
shipped from Daly City refers to Store Locations where City Name = 'Daly City'; orders refer to OrderNumber;
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`City Name` = 'Daly City' THEN T1.OrderNumber END AS T FROM `Sales Orders` T1 INNER JOIN `Store Locations` T2 ON T2.StoreID = T1._StoreID ) WHERE T IS NOT NULL
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,651
2,651
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "AS", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
11
medium
{ "case_1": [ 127, 129, 158, 394, 479, 666, 909, 944, 975 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many orders made by Rochester Ltd?
Rochester Ltd is the name of the customer; orders refer to OrderNumber;
SELECT SUM(CASE WHEN T1.`Customer Names` = 'Rochester Ltd' THEN 1 ELSE 0 END) FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,652
2,652
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
State the order number where Qualitest ordered the highest product quantity.
Qualitest ordered the highest product quantity refers to Customer Names where MAX(Order Quantity);
SELECT T1.OrderNumber FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Qualitest ' ORDER BY T1.`Order Quantity` DESC LIMIT 1
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,653
2,653
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Order Quantity" INTEGER )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
9
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
List the order for all in-store sales along with the products sold.
orders for all in-store sales refer to OrderNumber where Sales Channel = 'In-Store'; products refer to Product Name;
SELECT DISTINCT T1.OrderNumber, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.`Sales Channel` = 'In-Store'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,654
2,654
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "SELECT", "-", "INNER JOIN", "ON", "In", "FROM" ]
8
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many online sales were made in May 2018 where products were shipped from Norman?
online sales refer to OrderNumber where Sales Channel = 'Online'; May 2018 refers to OrderDate LIKE '5/%/18'; Norman is the name of the city;
SELECT SUM(CASE WHEN T1.OrderDate LIKE '5/%/18' AND T1.`Sales Channel` = 'Online' AND T2.`City Name` = 'Norman' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,655
2,655
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, OrderDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "FROM" ]
12
medium
{ "case_1": [ 127, 129, 158, 479, 666, 909, 944 ], "case_2": [ 127, 129, 158, 479, 666, 909, 944 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 918, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 4, 5, 6, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 59, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 81, 82, 83, 85, 88, 90, 93, 94, 95, 96, 98, 99, 104, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 136, 138, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 200, 201, 202, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 247, 248, 254, 256, 258, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 304, 313, 314, 315, 316, 317, 319, 322, 323, 325, 330, 335, 339, 341, 347, 356, 360, 361, 363, 365, 368, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 407, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 430, 433, 436, 437, 438, 440, 444, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 483, 486, 487, 488, 490, 493, 494, 496, 497, 498, 500, 504, 507, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 605, 608, 609, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 630, 632, 633, 637, 638, 640, 641, 643, 646, 648, 650, 651, 658, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 706, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 774, 775, 776, 777, 780, 783, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 819, 823, 824, 825, 827, 828, 829, 830, 832, 835, 838, 841, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 875, 877, 878, 879, 880, 886, 888, 892, 895, 896, 902, 905, 907, 909, 912, 917, 918, 922, 923, 924, 926, 928, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 979, 980, 985, 986, 991, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1058, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1128, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
Among the products sold in Maricopa County, which was the least sold?
the least sold product refers to Product Name where MIN(Order Quantity);
SELECT T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.County = 'Maricopa County' ORDER BY T2.`Order Quantity` ASC LIMIT 1
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,656
2,656
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, County TEXT ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Order Quantity" INTEGER )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "ASC", "FROM" ]
12
medium
{ "case_1": [ -1 ], "case_2": [ 264, 528, 744 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 713, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1024, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
State all the order numbers for sales team of Samuel Fowler.
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Sales Team` = 'Samuel Fowler' THEN T1.OrderNumber ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN `Sales Team` T2 ON T2.SalesTeamID = T1._SalesTeamID ) WHERE T IS NOT NULL
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,657
2,657
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "AS", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
12
medium
{ "case_1": [ 247, 298, 912, 918, 1066 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 508, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1012, 1013, 1014, 1015, 1016, 1017, 1019, 1020, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Find the number of baseball ordered in December 2017.
Product Name = 'Baseball'; December 2017 refers to OrderDate LIKE '12/%/17';
SELECT COUNT(T2.OrderNumber) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T1.`Product Name` = 'Baseball' AND T2.OrderDate LIKE '12/%/18'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,658
2,658
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "LIKE", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 421, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 591, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Find the average number of ornaments sold each month in 2018.
DIVIDE(SUM(Order Quantity where Product Name = 'Ornaments' and OrderDate LIKE '%/18'), 12);
SELECT CAST(SUM(T2.`Order Quantity`) AS REAL) / 12 FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T1.`Product Name` = 'Ornaments' AND T2.OrderDate LIKE '%/%/18'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,659
2,659
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Order Quantity" INTEGER )
[ "AS", "AND", "SELECT", "SUM", "LIKE", "INNER JOIN", "ON", "CAST", "FROM" ]
11
medium
{ "case_1": [ 202, 438, 724, 832, 837, 880 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Find the percentage of products that were shipped from Burbank in 2018?
DIVIDE(SUM(Order Quantity where City Name = 'Burbank' and SUBSTR(OrderDate, -2) = '18')), (SUM(Order Quantity where SUBSTR(OrderDate, -2) = '18')) as percentage;
SELECT CAST(SUM(CASE WHEN T3.`City Name` = 'Burbank' THEN T2.`Order Quantity` ELSE 0 END) AS REAL) * 100 / SUM(T2.`Order Quantity`) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T2.OrderDate LIKE '%/%/18'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,660
2,660
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Order Quantity" INTEGER )
[ "CASE WHEN", "AS", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "CAST", "FROM" ]
16
challenging
{ "case_1": [ 264, 528, 744 ], "case_2": [ 264, 528, 744 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 832, 844, 880, 909, 912, 918, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 6, 16, 20, 24, 26, 39, 42, 57, 59, 61, 64, 71, 77, 81, 82, 83, 90, 93, 94, 104, 106, 112, 113, 119, 120, 126, 127, 129, 131, 136, 141, 146, 148, 152, 153, 155, 158, 169, 171, 179, 184, 186, 189, 191, 192, 195, 201, 202, 207, 212, 213, 215, 219, 223, 225, 226, 228, 234, 236, 240, 247, 248, 254, 258, 261, 264, 267, 271, 277, 278, 279, 298, 299, 300, 304, 313, 315, 316, 317, 322, 323, 335, 341, 347, 356, 360, 363, 365, 373, 375, 378, 379, 381, 383, 393, 398, 402, 403, 406, 407, 409, 412, 415, 423, 427, 430, 433, 438, 444, 448, 450, 451, 452, 453, 458, 470, 476, 478, 479, 483, 485, 486, 487, 488, 500, 504, 514, 517, 518, 528, 532, 535, 537, 540, 547, 550, 557, 560, 563, 564, 571, 573, 575, 579, 580, 581, 597, 609, 612, 620, 623, 624, 628, 630, 638, 640, 646, 650, 658, 662, 666, 672, 675, 676, 682, 686, 690, 695, 701, 706, 710, 717, 723, 740, 743, 744, 745, 747, 749, 750, 753, 754, 756, 762, 772, 774, 776, 777, 787, 788, 795, 796, 798, 800, 802, 804, 805, 808, 810, 813, 823, 825, 827, 828, 832, 841, 844, 848, 850, 858, 868, 870, 871, 874, 875, 879, 880, 894, 896, 898, 907, 909, 912, 917, 918, 922, 924, 926, 930, 943, 944, 958, 959, 962, 973, 979, 980, 985, 998, 1000, 1008, 1012, 1019, 1022, 1023, 1027, 1031, 1038, 1042, 1062, 1064, 1066, 1068, 1069, 1072, 1078, 1082, 1087, 1092, 1098, 1100, 1101, 1111, 1128, 1131, 1133, 1134, 1135 ] }
regional_sales
What is the difference in order number from "WARE-MKL1006" and "WARE-NBV1002"?
"WARE-NBV1002" and "WARE-MKL1006" are both WarehouseCode; difference in order number = Subtract(Count(OrderNumber where WarehouseCode = 'WARE-MKL1006'), Count(OrderNumber where WarehouseCode = 'WARE-NBV1002'))
SELECT SUM(IIF(WarehouseCode = 'WARE-MKL1006', 1, 0)) - SUM(IIF(WarehouseCode = 'WARE-NBV1002', 1, 0)) AS difference FROM `Sales Orders`
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,661
2,661
CREATE TABLE `Sales Orders` ( WarehouseCode TEXT )
[ "AS", "SELECT", "SUM", "-", "FROM" ]
7
simple
{ "case_1": [ 92 ], "case_2": [ 92, 601 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 253, 254, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 350, 353, 354, 356, 357, 358, 360, 361, 362, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 667, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 679, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 733, 734, 735, 736, 737, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 817, 818, 819, 822, 823, 824, 825, 826, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 864, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 955, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 979, 980, 981, 982, 985, 986, 987, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1075, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Describe the product names delivered in 2021 for the customer "Sundial".
delivered in 2021 refer to DeliveryDate LIKE '%/21'; 'Sundial' is the Customer Names
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.DeliveryDate LIKE '%/%/21' AND T1.`Customer Names` = 'Sundial ' THEN T3.`Product Name` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,662
2,662
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( DeliveryDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "LIKE", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
15
medium
{ "case_1": [ 806 ], "case_2": [ 806 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 4, 5, 6, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 59, 63, 64, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 81, 82, 85, 88, 90, 92, 93, 95, 96, 98, 99, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 136, 138, 141, 142, 143, 144, 146, 148, 150, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 187, 191, 195, 197, 200, 201, 202, 207, 212, 214, 219, 225, 226, 227, 234, 236, 239, 240, 244, 247, 248, 256, 258, 261, 262, 263, 264, 265, 266, 267, 268, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 303, 304, 305, 314, 315, 317, 319, 322, 325, 330, 335, 339, 341, 347, 356, 360, 361, 368, 370, 373, 374, 375, 376, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 407, 408, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 430, 433, 436, 437, 438, 440, 443, 444, 446, 448, 451, 452, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 486, 490, 493, 494, 496, 497, 498, 500, 507, 508, 514, 515, 516, 518, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 580, 581, 582, 584, 586, 588, 589, 595, 601, 605, 608, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 632, 633, 637, 640, 641, 643, 646, 648, 651, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 697, 699, 702, 706, 710, 712, 714, 715, 723, 724, 726, 727, 734, 735, 739, 740, 741, 743, 744, 746, 747, 749, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 774, 775, 776, 777, 780, 783, 787, 788, 793, 796, 797, 799, 800, 804, 805, 806, 807, 808, 810, 814, 819, 824, 825, 827, 828, 829, 830, 832, 835, 837, 838, 841, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 875, 877, 878, 879, 880, 886, 888, 892, 894, 895, 896, 902, 905, 907, 909, 912, 917, 918, 922, 923, 924, 926, 927, 928, 930, 931, 932, 935, 941, 943, 944, 949, 953, 954, 956, 958, 959, 961, 969, 974, 978, 980, 982, 985, 986, 991, 996, 1000, 1001, 1012, 1014, 1017, 1019, 1020, 1022, 1023, 1027, 1031, 1036, 1039, 1042, 1044, 1046, 1048, 1058, 1059, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1128, 1129, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
Write down the store IDs and region of the state "Michigan".
"Michigan" is the State
SELECT DISTINCT T2.StoreID, T1.Region FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'Michigan'
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,663
2,663
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ -1 ], "case_2": [ 171, 672, 706 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1075, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Compare the total number of orders between customer "Apollo Ltd" and "Pacific Ltd".
"Apollo Ltd" and "Pacific Ltd" are both Customer Names; total number of orders refers to COUNT(OrderNumber)
SELECT SUM(CASE WHEN T2.`Customer Names` = 'Apollo Ltd' THEN 1 ELSE 0 END), SUM(CASE WHEN T2.`Customer Names` = 'Pacific Ltd' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,664
2,664
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
12
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Find the store ID with more orders between "Aurora" and "Babylon" city.
"Aurora" refers to City Name = 'Aurora (Township)'; "Babylon" refers to City Name = 'Babylong (Town)'; more order refers to Max(Count(OrderNumber))
SELECT T2.StoreID FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T2.`City Name` = 'Aurora (Township)' OR T2.`City Name` = 'Babylon (Town)' GROUP BY T2.StoreID ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,665
2,665
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "GROUP BY", "OR", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 394, 909, 975 ], "case_2": [ 394, 411, 909, 975 ], "case_3": [ 49, 126, 202, 247, 348, 394, 411, 909, 912, 918, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 4, 6, 10, 11, 13, 15, 16, 20, 22, 27, 28, 29, 30, 36, 37, 42, 47, 49, 51, 53, 55, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 82, 86, 88, 89, 91, 93, 96, 98, 106, 108, 113, 115, 117, 118, 119, 121, 125, 126, 131, 138, 140, 142, 143, 146, 148, 150, 152, 159, 160, 162, 163, 164, 167, 169, 170, 173, 175, 179, 183, 184, 185, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 229, 233, 234, 239, 243, 244, 247, 252, 254, 256, 261, 262, 267, 268, 269, 275, 276, 277, 278, 281, 285, 286, 291, 299, 301, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 394, 395, 401, 403, 406, 409, 411, 412, 416, 417, 424, 426, 428, 429, 434, 435, 436, 444, 445, 448, 451, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 490, 493, 495, 497, 500, 505, 509, 515, 516, 519, 520, 526, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 552, 558, 559, 560, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 657, 658, 659, 662, 663, 664, 665, 668, 669, 671, 681, 687, 688, 690, 691, 694, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 748, 749, 750, 751, 752, 753, 756, 759, 760, 762, 768, 769, 772, 778, 779, 787, 790, 796, 797, 799, 800, 802, 803, 804, 810, 812, 813, 814, 818, 819, 823, 824, 827, 829, 830, 838, 839, 841, 849, 850, 851, 853, 857, 861, 866, 867, 869, 870, 874, 876, 877, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 943, 950, 951, 953, 954, 956, 958, 961, 962, 963, 966, 967, 969, 970, 972, 973, 975, 977, 981, 983, 985, 986, 987, 993, 994, 996, 1004, 1005, 1006, 1010, 1013, 1015, 1017, 1022, 1023, 1025, 1030, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1071, 1072, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1100, 1101, 1103, 1104, 1106, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
List down the customer names and product names of the order made by "Anthony Torres" via distributor channel.
"Anthony Torres" is the name of Sales Team; distributor channel refers to Sales Channel = 'Distributor'
SELECT DISTINCT T1.`Customer Names`, T4.`Product Name` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID INNER JOIN Products AS T4 ON T4.ProductID = T2._ProductID WHERE T3.`Sales Team` = 'Anthony Torres' AND T2.`Sales Channel` = 'Distributor'
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,666
2,666
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
13
medium
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Mention the customer names and IDs which ordered total net profit of above 5000 USD through online channel.
IDs refers to CustomerID; total net profit of above 5000 USD refers to SUM(Subtract(Unit Price, Unit Cost)) > 5000
SELECT DISTINCT `Customer Names`, CustomerID FROM ( SELECT T2.`Customer Names`, T2.CustomerID , SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) AS T FROM `Sales Orders` T1 INNER JOIN Customers T2 ON T2.CustomerID = T1._CustomerID WHERE T1.`Sales Channel` = 'Online' GROUP BY T2.CustomerID ) WHERE T > 5000
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,667
2,667
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "GROUP BY", "AS", "SELECT", "SUM", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 987, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Find the net profit of the floral products which were delivered in 2021.
floral product refers to Product Name = 'Floral'; total net profit = SUM(Subtract(Unit Price, Unit Cost)); delivered in 2021 refers to DeliveryDate LIKE '%/21'
SELECT SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.DeliveryDate LIKE '%/%/21' AND T2.`Product Name` = 'Floral'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,668
2,668
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( DeliveryDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "AS", "AND", "SELECT", "SUM", "LIKE", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ 34 ], "case_2": [ 34, 202, 438, 724, 832, 837, 880 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Count the number of orders made from the store in city with population of 3000000 to 4000000.
number of order refers to OrderNumber; population of 3000000 to 4000000 refers to Population BETWEEN 3000000 AND 4000000
SELECT COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T2.Population BETWEEN 3000000 AND 4000000
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,669
2,669
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, Population INTEGER ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "BETWEEN", "FROM" ]
9
simple
{ "case_1": [ 139 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 399, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 421, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 656, 657, 658, 659, 660, 662, 663, 665, 666, 667, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Name the products via wholesale channel of the store under Pacific/Honolulu time zone.
products refers to Product Name; via wholesale channel refers to Sales Channel = 'Wholesale'
SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.`Time Zone` = 'Pacific/Honolulu' AND T2.`Sales Channel` = 'Wholesale' THEN T1.`Product Name` ELSE NULL END AS T FROM Products T1 INNER JOIN `Sales Orders` T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` T3 ON T3.StoreID = T2._StoreID ) WHERE T IS NOT NULL
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,670
2,670
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "Time Zone" TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "/", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
16
challenging
{ "case_1": [ 264, 528, 744 ], "case_2": [ 264, 528, 744 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 944, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 4, 5, 6, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 63, 64, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 81, 85, 88, 90, 92, 93, 95, 96, 97, 98, 99, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 138, 141, 142, 143, 144, 146, 148, 150, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 180, 183, 184, 187, 191, 195, 197, 200, 201, 207, 212, 214, 219, 225, 226, 227, 234, 236, 239, 240, 244, 248, 256, 258, 261, 262, 263, 264, 265, 266, 267, 268, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 303, 304, 305, 314, 315, 317, 319, 322, 325, 330, 335, 339, 341, 347, 356, 360, 361, 368, 370, 374, 375, 376, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 408, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 443, 444, 446, 448, 451, 452, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 486, 487, 490, 493, 494, 496, 497, 498, 500, 507, 508, 514, 515, 516, 518, 519, 520, 522, 524, 526, 528, 529, 530, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 580, 581, 582, 584, 586, 588, 589, 595, 601, 605, 608, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 632, 633, 636, 637, 640, 641, 643, 646, 648, 649, 651, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 697, 699, 702, 706, 710, 712, 714, 715, 723, 724, 726, 727, 734, 735, 739, 740, 741, 743, 744, 746, 747, 749, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 775, 776, 777, 780, 783, 787, 788, 793, 796, 797, 799, 800, 804, 805, 806, 807, 808, 810, 813, 814, 819, 824, 825, 827, 829, 830, 832, 835, 837, 838, 841, 844, 848, 849, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 877, 878, 879, 880, 886, 888, 892, 894, 895, 896, 902, 905, 907, 909, 912, 917, 922, 923, 924, 926, 927, 928, 930, 931, 932, 935, 941, 943, 944, 949, 953, 954, 956, 958, 959, 961, 969, 974, 978, 982, 985, 986, 991, 996, 1000, 1001, 1012, 1014, 1017, 1019, 1020, 1022, 1023, 1027, 1031, 1036, 1039, 1042, 1044, 1046, 1048, 1058, 1059, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1115, 1119, 1123, 1128, 1129, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
List the order numbers and product names which were ordered on 6th June, 2018.
ordered on 6th June 2018 refers to OrderDate = '6/5/18'
SELECT DISTINCT OrderNumber, `Product Name` FROM ( SELECT IIF(T2.OrderDate = '6/6/18', T2.OrderNumber, NULL) AS "OrderNumber" , IIF(T2.OrderDate = '6/6/18', T1.`Product Name`, NULL) AS "Product Name" FROM Products T1 INNER JOIN `Sales Orders` T2 ON T2._ProductID = T1.ProductID ) WHERE OrderNumber IS NOT NULL AND `Product Name` IS NOT NULL
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,671
2,671
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "/", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
21
challenging
{ "case_1": [ -1 ], "case_2": [ 438, 724, 832, 837, 880 ], "case_3": [ 92, 126, 127, 129, 158, 171, 219, 258, 263, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 747, 805, 806, 832, 837, 844, 880, 944, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 4, 5, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 63, 66, 67, 68, 69, 71, 73, 74, 75, 76, 85, 88, 90, 92, 93, 95, 96, 97, 98, 99, 106, 111, 112, 113, 115, 116, 117, 118, 119, 125, 126, 127, 128, 129, 131, 138, 141, 142, 143, 144, 146, 148, 150, 152, 154, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 180, 183, 184, 187, 195, 197, 200, 214, 219, 227, 239, 240, 244, 256, 258, 262, 263, 265, 266, 267, 268, 272, 275, 276, 277, 278, 282, 296, 298, 299, 301, 303, 305, 314, 315, 317, 319, 325, 330, 339, 341, 356, 361, 368, 370, 374, 375, 376, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 408, 413, 414, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 443, 444, 446, 448, 451, 452, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 487, 490, 493, 494, 496, 497, 498, 500, 507, 508, 514, 515, 516, 519, 520, 522, 524, 526, 528, 529, 530, 533, 537, 539, 541, 544, 557, 558, 559, 561, 562, 563, 573, 581, 582, 584, 586, 588, 589, 595, 601, 605, 608, 610, 612, 613, 615, 620, 624, 625, 626, 627, 632, 633, 636, 637, 641, 643, 646, 648, 649, 651, 663, 666, 668, 671, 672, 675, 677, 678, 683, 684, 685, 686, 687, 690, 693, 697, 699, 702, 706, 712, 714, 715, 724, 726, 727, 734, 735, 739, 740, 741, 743, 746, 747, 749, 753, 754, 756, 758, 760, 763, 765, 767, 768, 772, 773, 775, 776, 777, 780, 783, 788, 793, 797, 799, 800, 804, 805, 806, 807, 808, 810, 813, 814, 819, 824, 825, 829, 830, 832, 835, 837, 838, 844, 848, 849, 851, 853, 858, 859, 860, 861, 867, 870, 873, 877, 878, 879, 880, 886, 888, 892, 894, 895, 896, 902, 905, 907, 917, 923, 924, 926, 927, 928, 930, 931, 932, 935, 941, 944, 949, 953, 954, 956, 958, 961, 969, 974, 978, 982, 985, 986, 991, 996, 1000, 1001, 1014, 1017, 1019, 1020, 1022, 1023, 1027, 1031, 1036, 1039, 1042, 1044, 1046, 1048, 1058, 1059, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1080, 1084, 1086, 1092, 1100, 1101, 1103, 1104, 1105, 1109, 1115, 1119, 1123, 1128, 1129, 1131, 1133, 1134, 1136 ] }
regional_sales
Find the average yearly order by customer Weimei Corp for 2018, 2019 and 2020.
"Weimei Corp" is the Customer Names; in 2018, 2019 and 2020 refers to SUBSTR (OrderDate, -2) IN ('18', '19', '20') : Average order = Divide (Count (OrderNumber), 3)
SELECT COUNT(T1.OrderNumber) / 3 FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE (T1.OrderDate LIKE '%/%/18' AND T2.`Customer Names` = 'Weimei Corp') OR (T1.OrderDate LIKE '%/%/19' AND T2.`Customer Names` = 'Weimei Corp') OR (T1.OrderDate LIKE '%/%/20' AND T2.`Customer Names` = 'Weimei Corp')
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,672
2,672
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "OR", "AND", "SELECT", "AS", "LIKE", "INNER JOIN", "ON", "COUNT", "FROM" ]
15
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 421, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 591, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Calculate the average monthly order and percentage of warehouse "WARE-NMK1003" in 2019. Among them, mention number of orders for floor lamps.
"WARE-NMK1003" is the WarehouseCode; in 2019 refers to SUBSTR(OrderDate, -2) = '19'; average = Divide (Count (OrderNumber where SUBSTR(OrderDate, -2) = '19'), 12); Percentage = Divide (Count(OrderNumber where WarehouseCode = 'WARE-NMK1003'), Count(OrderNumber)) * 100; 'Floor Lamps' is the Product Name; number of orders refers to Count(OrderNumber)
SELECT CAST(SUM(CASE WHEN T2.WarehouseCode = 'WARE-NMK1003' THEN 1 ELSE 0 END) AS REAL) / 12 , CAST(SUM(CASE WHEN T2.WarehouseCode = 'WARE-NMK1003' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.OrderNumber), COUNT(CASE WHEN T1.`Product Name` = 'Floor Lamps' AND T2.WarehouseCode = 'WARE-NMK1003' THEN T2.`Order Quantity` ELSE NULL END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T2.OrderDate LIKE '%/%/19'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,673
2,673
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, WarehouseCode TEXT, OrderDate TEXT, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Order Quantity" INTEGER )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "LIKE", "CASE", "-", "NULL", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
26
challenging
{ "case_1": [ -1 ], "case_2": [ 438, 832 ], "case_3": [ 126, 127, 129, 153, 158, 219, 258, 264, 398, 438, 528, 666, 744, 747, 805, 832, 844, 909, 912, 944, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 39, 42, 53, 61, 64, 71, 74, 77, 81, 93, 98, 106, 112, 113, 115, 119, 120, 126, 127, 129, 131, 141, 146, 148, 152, 153, 155, 158, 169, 183, 184, 187, 189, 191, 192, 195, 197, 201, 207, 212, 219, 223, 225, 226, 234, 236, 240, 244, 248, 254, 258, 261, 264, 267, 271, 277, 279, 299, 300, 304, 316, 317, 322, 323, 325, 335, 339, 341, 347, 356, 360, 375, 382, 383, 391, 393, 398, 402, 403, 406, 409, 412, 415, 416, 423, 427, 436, 438, 444, 448, 452, 453, 458, 476, 478, 485, 486, 487, 493, 500, 504, 510, 514, 516, 517, 518, 520, 522, 528, 535, 537, 540, 544, 547, 550, 559, 563, 564, 571, 573, 575, 580, 581, 597, 620, 623, 624, 628, 640, 646, 658, 662, 666, 675, 676, 682, 686, 690, 710, 712, 723, 740, 743, 744, 747, 749, 750, 753, 754, 756, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 802, 804, 805, 808, 810, 813, 827, 832, 838, 841, 844, 848, 858, 868, 870, 871, 874, 894, 896, 909, 912, 917, 922, 924, 926, 930, 935, 943, 944, 954, 958, 959, 985, 998, 1008, 1012, 1022, 1023, 1031, 1042, 1062, 1064, 1068, 1069, 1072, 1078, 1082, 1087, 1092, 1098, 1100, 1101, 1123, 1128, 1131, 1133, 1134, 1135 ] }
regional_sales
Indicate the procured dates for the customer whose ID is 11.
ID is 11 refers to _CustomerID = 11;
SELECT DISTINCT T FROM ( SELECT IIF(_CustomerID = 11, ProcuredDate, NULL) AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,674
2,674
CREATE TABLE `Sales Orders` ( ProcuredDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "AS", "SELECT", "NULL", "NOT", "IS", "FROM" ]
9
simple
{ "case_1": [ 92 ], "case_2": [ 92, 601 ], "case_3": [ 92, 126, 158, 171, 258, 263, 298, 303, 305, 398, 443, 479, 528, 601, 672, 706, 724, 805, 837, 844, 880, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 7, 16, 42, 53, 67, 92, 106, 126, 138, 148, 150, 152, 158, 171, 195, 200, 258, 263, 267, 294, 298, 299, 303, 305, 375, 393, 395, 398, 402, 406, 423, 436, 443, 458, 476, 478, 479, 485, 493, 508, 514, 516, 522, 528, 533, 573, 589, 601, 620, 637, 646, 672, 706, 712, 724, 772, 805, 837, 844, 880, 894, 926, 927, 935, 941, 965, 978, 982, 985, 1014, 1020, 1036, 1048, 1059, 1062, 1066, 1069, 1129, 1131, 1133, 1134 ] }
regional_sales
How many orders through distributor were for the minimum quantity?
"Distributor" is the Sales Channel; minimum quantity refers to Min(Order Quantity)
SELECT SUM(CASE WHEN `Order Quantity` = 1 AND `Sales Channel` = 'Distributor' THEN 1 ELSE 0 END) FROM `Sales Orders`
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,675
2,675
CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, "Order Quantity" INTEGER )
[ "CASE WHEN", "AND", "SELECT", "SUM", "CASE", "FROM" ]
6
simple
{ "case_1": [ -1 ], "case_2": [ 601 ], "case_3": [ 127, 129, 153, 158, 219, 258, 264, 305, 398, 438, 528, 601, 666, 744, 747, 832, 844, 909, 912, 944 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 39, 42, 54, 61, 64, 71, 77, 81, 93, 104, 106, 112, 113, 120, 122, 127, 129, 141, 148, 152, 153, 155, 158, 169, 173, 184, 191, 192, 195, 201, 205, 207, 212, 215, 219, 223, 225, 226, 234, 236, 245, 248, 258, 261, 264, 267, 271, 279, 299, 300, 304, 305, 317, 322, 335, 347, 350, 356, 360, 362, 375, 383, 393, 398, 402, 406, 412, 415, 423, 427, 438, 448, 452, 453, 458, 470, 476, 478, 485, 486, 500, 504, 508, 510, 514, 517, 518, 528, 535, 537, 540, 547, 550, 563, 564, 571, 573, 575, 580, 581, 601, 612, 620, 623, 628, 640, 646, 662, 666, 676, 682, 686, 690, 709, 710, 723, 740, 744, 747, 753, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 808, 810, 825, 827, 832, 841, 844, 848, 868, 870, 871, 872, 874, 896, 909, 912, 922, 924, 926, 939, 943, 944, 958, 959, 979, 985, 998, 1008, 1012, 1023, 1027, 1031, 1036, 1048, 1062, 1064, 1068, 1069, 1078, 1082, 1087, 1092, 1093, 1098, 1100, 1110, 1121, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
List by ID all sales teams that have sold products at a 10% discount in store.
ID refers to _SalesTeamID; 10% discount refers to Discount Applied = 0.1; 'In-Store' is the Sales Channel
SELECT DISTINCT T FROM ( SELECT CASE WHEN `Discount Applied` = '0.1' AND `Sales Channel` = 'In-Store' THEN _SalesTeamID ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,676
2,676
CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, "Discount Applied" REAL )
[ "AS", "AND", "SELECT", "CASE", "-", "NULL", "NOT", "In", "IS", "FROM" ]
13
medium
{ "case_1": [ 601 ], "case_2": [ 92, 601 ], "case_3": [ 92, 158, 171, 258, 263, 298, 303, 305, 398, 443, 479, 528, 601, 672, 706, 724, 805, 837, 844, 880, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 42, 53, 67, 92, 138, 148, 150, 152, 158, 171, 195, 258, 263, 267, 298, 303, 305, 383, 393, 395, 398, 402, 406, 436, 443, 476, 479, 493, 508, 514, 516, 522, 528, 533, 589, 601, 637, 672, 706, 712, 724, 788, 798, 805, 837, 844, 880, 894, 927, 935, 941, 978, 982, 985, 1014, 1020, 1036, 1048, 1059, 1066, 1069, 1092, 1129, 1131 ] }
regional_sales
How many Borough-type stores located in the city of Brooklyn have a population of less than 3 million?
"Brooklyn" is the CityName; population of less than 3 million refers to Population < 3000000
SELECT SUM(CASE WHEN Population < 3000000 AND Type = 'Borough' AND `City Name` = 'Brooklyn' THEN 1 ELSE 0 END) FROM `Store Locations`
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,677
2,677
CREATE TABLE `Store Locations` ( "City Name" TEXT, Population INTEGER )
[ "CASE WHEN", "AND", "SELECT", "SUM", "CASE", "FROM" ]
7
simple
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 127, 129, 153, 158, 219, 258, 264, 305, 398, 438, 528, 601, 666, 744, 747, 832, 844, 909, 912, 944 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 39, 42, 54, 61, 64, 71, 77, 81, 93, 104, 106, 112, 113, 120, 122, 127, 129, 141, 148, 152, 153, 155, 158, 169, 173, 184, 191, 192, 195, 201, 205, 207, 212, 215, 219, 223, 225, 226, 234, 236, 245, 248, 258, 261, 264, 267, 271, 279, 299, 300, 304, 305, 317, 322, 335, 347, 350, 356, 360, 362, 375, 383, 393, 398, 402, 406, 412, 415, 423, 427, 438, 448, 452, 453, 458, 470, 476, 478, 485, 486, 500, 504, 508, 510, 514, 517, 518, 528, 535, 537, 540, 547, 550, 563, 564, 571, 573, 575, 580, 581, 601, 612, 620, 623, 628, 640, 646, 662, 666, 676, 682, 686, 690, 709, 710, 723, 740, 744, 747, 753, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 808, 810, 825, 827, 832, 841, 844, 848, 868, 870, 871, 872, 874, 896, 909, 912, 922, 924, 926, 939, 943, 944, 958, 959, 979, 985, 998, 1008, 1012, 1023, 1027, 1031, 1036, 1048, 1062, 1064, 1068, 1069, 1078, 1082, 1087, 1092, 1093, 1098, 1100, 1110, 1121, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
How many states are in the Midwest region?
SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN State ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,678
2,678
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT )
[ "AS", "SELECT", "CASE", "NULL", "NOT", "COUNT", "IS", "FROM" ]
11
medium
{ "case_1": [ 303, 443 ], "case_2": [ 303, 443, 982 ], "case_3": [ 92, 126, 158, 171, 258, 263, 298, 303, 305, 398, 443, 479, 528, 601, 672, 706, 724, 805, 837, 844, 880, 909, 912, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 42, 53, 61, 67, 77, 92, 106, 113, 126, 138, 148, 150, 152, 158, 171, 191, 192, 195, 212, 225, 226, 234, 258, 261, 263, 267, 271, 294, 298, 299, 303, 305, 335, 360, 375, 383, 393, 395, 398, 402, 406, 412, 423, 436, 443, 453, 458, 476, 478, 479, 485, 493, 500, 504, 508, 514, 516, 517, 522, 528, 533, 535, 547, 563, 564, 573, 580, 581, 589, 601, 620, 637, 646, 662, 672, 706, 712, 724, 740, 753, 762, 772, 787, 795, 796, 798, 800, 805, 827, 837, 841, 844, 874, 880, 894, 896, 909, 912, 922, 924, 926, 927, 935, 941, 943, 965, 978, 982, 985, 1008, 1014, 1020, 1036, 1048, 1059, 1062, 1064, 1066, 1069, 1078, 1082, 1087, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
What are the top 10 products with the highest net profit?
products refers to Product Name; highest net profit = Max(Subtract(Unit Price, Unit Cost))
SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID GROUP BY T1._ProductID ORDER BY SUM(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '')) DESC LIMIT 10
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,679
2,679
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "GROUP BY", "AS", "SELECT", "SUM", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
11
medium
{ "case_1": [ 202, 438, 832 ], "case_2": [ 202, 438, 832 ], "case_3": [ 49, 126, 127, 129, 153, 202, 219, 247, 264, 348, 394, 411, 438, 666, 744, 747, 832, 909, 912, 918, 944, 975, 1077 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 1, 6, 10, 11, 13, 15, 20, 22, 24, 28, 29, 36, 39, 42, 49, 55, 59, 62, 64, 69, 71, 73, 75, 77, 78, 81, 83, 86, 89, 93, 94, 108, 112, 113, 115, 120, 121, 125, 126, 127, 129, 138, 140, 141, 142, 143, 148, 150, 153, 155, 159, 162, 163, 167, 169, 173, 179, 184, 186, 187, 188, 189, 191, 195, 199, 200, 201, 202, 206, 207, 212, 213, 214, 219, 225, 226, 228, 229, 233, 234, 236, 239, 247, 248, 252, 254, 261, 262, 264, 275, 278, 279, 281, 285, 286, 300, 304, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 329, 334, 335, 336, 341, 342, 344, 345, 347, 348, 349, 352, 353, 356, 359, 360, 363, 364, 365, 371, 373, 378, 379, 381, 383, 385, 394, 395, 402, 403, 409, 411, 412, 415, 424, 427, 428, 429, 434, 435, 438, 444, 445, 448, 450, 451, 452, 454, 460, 462, 469, 470, 473, 476, 482, 483, 486, 487, 488, 495, 497, 500, 505, 518, 530, 532, 535, 536, 537, 538, 540, 542, 547, 548, 550, 552, 560, 563, 564, 566, 567, 571, 575, 578, 579, 580, 581, 584, 586, 590, 592, 595, 597, 609, 611, 612, 621, 623, 625, 626, 628, 630, 634, 637, 638, 640, 645, 650, 651, 654, 657, 658, 659, 662, 664, 665, 666, 669, 676, 681, 682, 686, 688, 690, 691, 695, 696, 698, 701, 703, 710, 717, 719, 720, 721, 723, 733, 735, 740, 743, 744, 745, 747, 748, 750, 751, 752, 753, 759, 760, 762, 768, 776, 777, 778, 779, 787, 788, 790, 796, 800, 802, 803, 808, 810, 813, 818, 823, 825, 827, 830, 832, 841, 848, 850, 851, 861, 866, 868, 869, 870, 871, 874, 876, 882, 886, 889, 891, 893, 896, 901, 909, 911, 912, 918, 922, 924, 927, 929, 932, 934, 943, 944, 950, 951, 953, 954, 956, 958, 959, 962, 963, 966, 967, 970, 972, 973, 975, 977, 981, 987, 993, 994, 1004, 1005, 1006, 1010, 1012, 1013, 1017, 1023, 1025, 1027, 1030, 1031, 1034, 1037, 1038, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1064, 1065, 1067, 1068, 1076, 1077, 1078, 1082, 1087, 1091, 1092, 1094, 1098, 1100, 1106, 1124, 1135, 1137 ] }
regional_sales
Indicate the name of the customers who have placed an order of 3 units in February 2018.
name of customer refers to Customer Names; order of 3 unit refers to Order Quantity = 3; in February 2018 refers to OrderDate LIKE '2/%/18'
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Order Quantity` = 3 AND T2.OrderDate LIKE '2/%/18' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,680
2,680
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Order Quantity" INTEGER )
[ "AS", "AND", "SELECT", "LIKE", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
13
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 126, 153, 219, 258, 747, 844 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 4, 5, 6, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 59, 63, 64, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 81, 82, 85, 88, 90, 92, 93, 95, 96, 98, 99, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 136, 138, 141, 142, 143, 144, 146, 148, 150, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 187, 191, 195, 197, 200, 201, 202, 207, 212, 214, 219, 225, 226, 227, 234, 236, 239, 240, 244, 247, 248, 256, 258, 261, 262, 263, 264, 265, 266, 267, 268, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 303, 304, 305, 314, 315, 317, 319, 322, 325, 330, 335, 339, 341, 347, 356, 360, 361, 368, 370, 373, 374, 375, 376, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 407, 408, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 430, 433, 436, 437, 438, 440, 443, 444, 446, 448, 451, 452, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 486, 490, 493, 494, 496, 497, 498, 500, 507, 508, 514, 515, 516, 518, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 580, 581, 582, 584, 586, 588, 589, 595, 601, 605, 608, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 632, 633, 637, 640, 641, 643, 646, 648, 651, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 697, 699, 702, 706, 710, 712, 714, 715, 723, 724, 726, 727, 734, 735, 739, 740, 741, 743, 744, 746, 747, 749, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 774, 775, 776, 777, 780, 783, 787, 788, 793, 796, 797, 799, 800, 804, 805, 806, 807, 808, 810, 814, 819, 824, 825, 827, 828, 829, 830, 832, 835, 837, 838, 841, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 875, 877, 878, 879, 880, 886, 888, 892, 894, 895, 896, 902, 905, 907, 909, 912, 917, 918, 922, 923, 924, 926, 927, 928, 930, 931, 932, 935, 941, 943, 944, 949, 953, 954, 956, 958, 959, 961, 969, 974, 978, 980, 982, 985, 986, 991, 996, 1000, 1001, 1012, 1014, 1017, 1019, 1020, 1022, 1023, 1027, 1031, 1036, 1039, 1042, 1044, 1046, 1048, 1058, 1059, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1128, 1129, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
What are the names of the sales teams that have served to customer Apotheca, Ltd?
name of sales team refers to Sales Team; 'Apotheca, Ltd' is the Customer Names
SELECT DISTINCT T3.`Sales Team` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T1.`Customer Names` = 'Apotheca, Ltd'
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,681
2,681
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{ "case_1": [ 499 ], "case_2": [ 499 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1075, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
In which regions are the stores that have shipped products through the WARE-UHY1004 warehouse?
"WARE-UHY1004" is the WarehouseCode
SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.WarehouseCode = 'WARE-UHY1004' THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode INNER JOIN `Sales Orders` T3 ON T3._StoreID = T2.StoreID ) WHERE T IS NOT NULL
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,682
2,682
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT ) CREATE TABLE `Sales Orders` ( WarehouseCode TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "AS", "SELECT", "CASE", "-", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
14
medium
{ "case_1": [ 805 ], "case_2": [ 805 ], "case_3": [ 34, 92, 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 394, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 837, 844, 880, 909, 912, 944, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 6, 7, 16, 21, 24, 34, 39, 42, 45, 53, 64, 71, 74, 77, 81, 85, 92, 97, 98, 105, 106, 112, 113, 115, 120, 126, 127, 128, 129, 135, 138, 141, 148, 150, 152, 153, 154, 155, 158, 171, 172, 180, 183, 184, 187, 189, 191, 195, 197, 199, 200, 201, 207, 212, 219, 225, 226, 228, 234, 236, 240, 244, 248, 258, 261, 263, 264, 267, 272, 279, 296, 298, 299, 300, 303, 304, 305, 322, 325, 335, 339, 347, 356, 360, 368, 375, 382, 383, 391, 392, 393, 394, 395, 398, 402, 406, 409, 412, 415, 416, 425, 427, 436, 438, 443, 445, 446, 448, 452, 476, 478, 479, 486, 489, 493, 496, 498, 500, 503, 507, 508, 509, 514, 516, 518, 520, 522, 528, 529, 533, 535, 540, 544, 547, 550, 559, 562, 563, 564, 571, 573, 575, 580, 581, 589, 601, 620, 623, 624, 628, 637, 640, 643, 646, 647, 649, 660, 662, 666, 672, 675, 676, 677, 681, 682, 684, 686, 693, 695, 706, 710, 712, 723, 724, 740, 744, 746, 747, 753, 754, 756, 758, 762, 772, 776, 777, 787, 788, 796, 800, 805, 808, 827, 829, 835, 837, 838, 841, 844, 848, 858, 868, 870, 871, 874, 878, 880, 882, 894, 896, 905, 909, 912, 922, 924, 925, 926, 927, 930, 935, 941, 943, 944, 954, 959, 974, 978, 980, 982, 985, 993, 1012, 1031, 1036, 1048, 1052, 1062, 1064, 1066, 1068, 1069, 1074, 1078, 1082, 1087, 1092, 1098, 1101, 1111, 1123, 1129, 1131, 1132, 1133, 1134, 1135 ] }
regional_sales
List all the cities where Shawn Torres sells Audio products.
"Shawn Torres" is the name of Sales Team; Audio product refers to Product Name = 'Audio'
SELECT T FROM ( SELECT DISTINCT CASE WHEN T4.`Product Name` = 'Audio' AND T3.`Sales Team` = 'Shawn Torres' THEN T1.`City Name` ELSE NULL END AS T FROM `Store Locations` T1 INNER JOIN `Sales Orders` T2 ON T2._StoreID = T1.StoreID INNER JOIN `Sales Team` T3 ON T3.SalesTeamID = T2._SalesTeamID INNER JOIN Products T4 ON T4.ProductID = T2._ProductID ) WHERE T IS NOT NULL
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,683
2,683
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
17
challenging
{ "case_1": [ 398 ], "case_2": [ 398 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 944, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 4, 5, 6, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 63, 64, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 81, 85, 88, 90, 92, 93, 95, 96, 98, 99, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 138, 141, 142, 143, 144, 146, 148, 150, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 180, 183, 184, 187, 191, 195, 197, 200, 201, 207, 212, 214, 219, 225, 226, 227, 234, 236, 239, 240, 244, 248, 256, 258, 261, 262, 263, 264, 265, 266, 267, 268, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 303, 304, 305, 314, 315, 317, 319, 322, 325, 330, 335, 339, 341, 347, 356, 360, 361, 368, 370, 374, 375, 376, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 408, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 443, 444, 446, 448, 451, 452, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 486, 490, 493, 494, 496, 497, 498, 500, 507, 508, 514, 515, 516, 518, 519, 520, 522, 524, 526, 528, 529, 530, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 580, 581, 582, 584, 586, 588, 589, 595, 601, 605, 608, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 632, 633, 637, 640, 641, 643, 646, 648, 651, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 697, 699, 702, 706, 710, 712, 714, 715, 723, 724, 726, 727, 734, 735, 739, 740, 741, 743, 744, 746, 747, 749, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 775, 776, 777, 780, 783, 787, 788, 793, 796, 797, 799, 800, 804, 805, 806, 807, 808, 810, 814, 819, 824, 825, 827, 829, 830, 832, 835, 837, 838, 841, 844, 848, 849, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 877, 878, 879, 880, 886, 888, 892, 894, 895, 896, 902, 905, 907, 909, 912, 917, 922, 923, 924, 926, 927, 928, 930, 931, 932, 935, 941, 943, 944, 949, 953, 954, 956, 958, 959, 961, 969, 974, 978, 982, 985, 986, 991, 996, 1000, 1001, 1012, 1014, 1017, 1019, 1020, 1022, 1023, 1027, 1031, 1036, 1039, 1042, 1044, 1046, 1048, 1058, 1059, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1115, 1119, 1123, 1128, 1129, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
Lists the name of the product and customer who placed an order on 10/21/18 and it was delivered on 11/21/19.
ordered on 10/21/18 refers to OrderDate = '10/21/18'; delivered on 11/21/19 refers to DeliveryDate = '11/21/19'; name of product refers to Product Name
SELECT T3.`Product Name`, T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products AS T3 ON T3.ProductID = T2._ProductID WHERE T2.OrderDate = '10/21/18' AND T2.DeliveryDate = '11/21/19'
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,684
2,684
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( OrderDate TEXT, DeliveryDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "/", "INNER JOIN", "ON", "FROM" ]
14
medium
{ "case_1": [ 806 ], "case_2": [ 806 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 551, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1009, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many stores procured products on October 27, 2018, in the city of Oregon?
October 27, 2018 refers to ProcuredDate = '10/27/18'; 'Oregon' is the State
SELECT SUM(CASE WHEN T1.ProcuredDate = '10/27/18' AND T2.`City Name` = 'Orlando' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,685
2,685
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( ProcuredDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "/", "CASE", "INNER JOIN", "ON", "FROM" ]
12
medium
{ "case_1": [ 127, 129, 158, 479, 666, 909, 944 ], "case_2": [ 127, 129, 158, 479, 666, 909, 944 ], "case_3": [ 127, 129, 153, 158, 171, 219, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 4, 5, 6, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 81, 83, 85, 88, 90, 93, 94, 95, 96, 97, 98, 99, 104, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 127, 128, 129, 131, 138, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 200, 201, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 248, 254, 256, 258, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 304, 313, 314, 315, 316, 317, 319, 322, 323, 325, 330, 335, 339, 341, 347, 356, 360, 361, 363, 365, 368, 370, 374, 375, 376, 378, 379, 381, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 444, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 483, 486, 487, 488, 490, 493, 494, 496, 497, 498, 500, 504, 507, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 528, 529, 530, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 605, 608, 609, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 630, 632, 633, 636, 637, 638, 640, 641, 643, 646, 648, 649, 650, 651, 658, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 706, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 775, 776, 777, 780, 783, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 819, 823, 824, 825, 827, 829, 830, 832, 835, 838, 841, 844, 848, 849, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 877, 878, 879, 880, 886, 888, 892, 895, 896, 902, 905, 907, 909, 912, 917, 922, 923, 924, 926, 928, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 985, 986, 991, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1058, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1115, 1119, 1123, 1128, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
What sales channels are used the most in the 3 places with the highest median income?
highest median income refers to Max(Median Income)
SELECT `Sales Channel` FROM ( SELECT T1.`Sales Channel` FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY T2.`Median Income` DESC LIMIT 3 ) GROUP BY `Sales Channel` ORDER BY COUNT(`Sales Channel`) DESC LIMIT 1
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,686
2,686
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "Median Income" INTEGER ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
16
challenging
{ "case_1": [ 411 ], "case_2": [ 394, 411, 909, 975 ], "case_3": [ 49, 126, 202, 247, 348, 394, 411, 909, 912, 918, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 4, 6, 10, 11, 13, 15, 16, 20, 22, 27, 28, 29, 30, 36, 37, 47, 49, 51, 53, 55, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 82, 86, 88, 89, 91, 93, 96, 98, 106, 108, 113, 115, 117, 118, 119, 121, 125, 126, 131, 138, 140, 142, 143, 146, 148, 150, 152, 159, 160, 162, 163, 164, 167, 169, 170, 173, 175, 179, 183, 184, 185, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 229, 233, 234, 239, 243, 244, 247, 252, 254, 256, 261, 262, 267, 268, 269, 275, 276, 277, 278, 281, 285, 286, 291, 299, 301, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 394, 395, 401, 403, 406, 409, 411, 412, 416, 417, 424, 426, 428, 429, 434, 435, 436, 444, 445, 448, 451, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 490, 493, 495, 497, 500, 505, 509, 515, 516, 519, 520, 526, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 552, 558, 559, 560, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 657, 658, 659, 662, 663, 664, 665, 668, 669, 671, 681, 687, 688, 690, 691, 694, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 748, 749, 750, 751, 752, 753, 756, 759, 760, 762, 768, 769, 772, 778, 779, 787, 790, 796, 797, 799, 800, 802, 803, 804, 810, 812, 813, 814, 818, 819, 823, 824, 827, 830, 838, 839, 841, 849, 850, 851, 853, 857, 861, 866, 867, 869, 870, 874, 876, 877, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 943, 950, 951, 953, 954, 956, 958, 961, 962, 963, 966, 967, 969, 970, 972, 973, 975, 977, 981, 983, 985, 986, 987, 993, 994, 996, 1004, 1005, 1006, 1010, 1013, 1015, 1017, 1022, 1023, 1025, 1030, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1071, 1072, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1100, 1101, 1103, 1104, 1106, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
List the 5 sales teams that have made sales with the highest net profits.
highest net profit = Max(Subtract (Unit Price, Unit Cost))
SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 5
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,687
2,687
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
What is the highest discount applied by the store located in a city of the state of Colorado whose land area is 111039036.
highest discount applied refers to Max(Discount Applied)
SELECT MAX(T1.`Discount Applied`) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T2.State = 'Colorado' AND T2.`Land Area` = 111039036
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,688
2,688
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT, "Land Area" INTEGER ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, "Discount Applied" REAL )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM", "MAX" ]
8
simple
{ "case_1": [ 139 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 109, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 820, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1073, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many different time zones are there in the Northeast region?
SELECT COUNT(DISTINCT T2.`Time Zone`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T1.Region = 'Northeast'
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,689
2,689
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT, "Time Zone" TEXT )
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
7
simple
{ "case_1": [ -1 ], "case_2": [ 171, 672, 706 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 303, 394, 398, 411, 438, 443, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
What type of store is most popular in the South?
in the South refers to Region = 'South'; type of store that is most popular refers to Max(Count(Type))
SELECT DISTINCT CASE WHEN MAX(T2.Population) THEN T2.Type END FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,690
2,690
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT, Type TEXT, Population INTEGER )
[ "CASE WHEN", "AS", "SELECT", "CASE", "INNER JOIN", "ON", "FROM", "MAX" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ 171, 672, 706 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
To which region does the sales team that has used the WARE-MKL1006 warehouse the most times for its shipments belong?
"WARE-MKL1006" is the WarehouseCode; most shipment to region refers to Max(Count(Region))
SELECT T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.WarehouseCode = 'WARE-MKL1006' GROUP BY T2.Region ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,691
2,691
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, WarehouseCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "-", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 247, 912, 918 ], "case_2": [ 247, 912, 918, 1128 ], "case_3": [ 34, 49, 126, 158, 202, 247, 348, 394, 411, 805, 909, 912, 918, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 6, 10, 11, 13, 15, 16, 20, 21, 22, 27, 28, 29, 30, 34, 36, 37, 39, 42, 45, 47, 49, 51, 53, 55, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 82, 85, 86, 88, 89, 91, 93, 96, 97, 98, 105, 106, 108, 112, 113, 115, 117, 118, 119, 121, 125, 126, 128, 131, 135, 138, 140, 141, 142, 143, 146, 148, 150, 152, 154, 158, 159, 160, 162, 163, 164, 167, 169, 170, 172, 173, 175, 179, 180, 183, 184, 185, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 228, 229, 233, 234, 239, 240, 243, 244, 247, 252, 254, 256, 261, 262, 267, 268, 269, 272, 275, 276, 277, 278, 281, 285, 286, 291, 296, 299, 300, 301, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 368, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 393, 394, 395, 401, 403, 406, 409, 411, 412, 416, 417, 424, 425, 426, 428, 429, 434, 435, 436, 444, 445, 446, 448, 451, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 489, 490, 493, 495, 496, 497, 498, 500, 503, 505, 507, 509, 514, 515, 516, 519, 520, 522, 526, 529, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 550, 552, 558, 559, 560, 562, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 624, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 643, 645, 646, 647, 649, 651, 654, 657, 658, 659, 660, 662, 663, 664, 665, 668, 669, 671, 675, 677, 681, 684, 687, 688, 690, 691, 693, 694, 695, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 746, 748, 749, 750, 751, 752, 753, 754, 756, 758, 759, 760, 762, 768, 769, 772, 777, 778, 779, 787, 788, 790, 796, 797, 799, 800, 802, 803, 804, 805, 810, 812, 813, 814, 818, 819, 823, 824, 827, 829, 830, 835, 838, 839, 841, 849, 850, 851, 853, 857, 858, 861, 866, 867, 869, 870, 874, 876, 877, 878, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 905, 909, 911, 912, 915, 917, 918, 922, 923, 924, 925, 926, 927, 929, 930, 932, 934, 935, 943, 950, 951, 953, 954, 956, 958, 959, 961, 962, 963, 966, 967, 969, 970, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 993, 994, 996, 1004, 1005, 1006, 1010, 1013, 1015, 1017, 1022, 1023, 1025, 1030, 1031, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1070, 1071, 1072, 1074, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1092, 1094, 1100, 1101, 1103, 1104, 1106, 1111, 1112, 1119, 1123, 1124, 1128, 1131, 1132, 1133, 1134, 1135, 1137 ] }
regional_sales
In which city is the store with the highest sales order unit price located?
highest sales order unit price refers to Max(Unit Price)
SELECT T2.`City Name` FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE REPLACE(T1.`Unit Price`, ',', '') = ( SELECT REPLACE(T1.`Unit Price`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,692
2,692
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, "Unit Price" TEXT )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
18
challenging
{ "case_1": [ 411 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
How many online purchases did Ole Group make in May 2019?
"Ole Group" is the Customer Names; online purchase refers to Sales Channel = 'Online'; made in May 2019 refers to OrderDate LIKE '5/%/19'
SELECT SUM(CASE WHEN T1.`Sales Channel` = 'Online' AND T2.`Customer Names` = 'Ole Group' AND T1.OrderDate LIKE '5/%/19' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,693
2,693
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "FROM" ]
12
medium
{ "case_1": [ 126, 219, 258, 747, 844 ], "case_2": [ 126, 153, 219, 258, 747, 844 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 398, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 918, 944, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 3, 4, 5, 6, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 59, 61, 63, 64, 66, 68, 69, 71, 73, 74, 75, 76, 77, 81, 82, 83, 85, 88, 90, 93, 94, 95, 96, 98, 99, 104, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 136, 138, 141, 142, 143, 144, 146, 148, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 179, 180, 183, 184, 186, 187, 189, 191, 192, 195, 197, 200, 201, 202, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 234, 236, 239, 240, 244, 247, 248, 254, 256, 258, 261, 262, 264, 265, 266, 267, 268, 271, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 304, 313, 314, 315, 316, 317, 319, 322, 323, 325, 330, 335, 339, 341, 347, 356, 360, 361, 363, 365, 368, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 407, 408, 409, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 430, 433, 436, 437, 438, 440, 444, 446, 448, 450, 451, 452, 453, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 483, 486, 487, 488, 490, 493, 494, 496, 497, 498, 500, 504, 507, 514, 515, 516, 517, 518, 519, 520, 522, 524, 526, 528, 529, 530, 532, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 579, 580, 581, 582, 584, 586, 588, 589, 595, 597, 605, 608, 609, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 630, 632, 633, 637, 638, 640, 641, 643, 646, 648, 650, 651, 658, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 695, 697, 699, 701, 702, 706, 710, 712, 714, 715, 717, 723, 726, 727, 734, 735, 739, 740, 741, 743, 744, 745, 746, 747, 749, 750, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 774, 775, 776, 777, 780, 783, 787, 788, 793, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 807, 808, 810, 813, 814, 819, 823, 824, 825, 827, 828, 829, 830, 832, 835, 838, 841, 844, 848, 849, 850, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 875, 877, 878, 879, 880, 886, 888, 892, 895, 896, 902, 905, 907, 909, 912, 917, 918, 922, 923, 924, 926, 928, 930, 931, 932, 935, 943, 944, 949, 953, 954, 956, 958, 959, 961, 962, 969, 973, 974, 979, 980, 985, 986, 991, 996, 998, 1000, 1001, 1008, 1012, 1017, 1019, 1022, 1023, 1027, 1031, 1038, 1039, 1042, 1044, 1046, 1058, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1111, 1115, 1119, 1123, 1128, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
How many stores with less need for products, and purchased through a distributor, are located in Washtenaw County?
less need for products refers to Order Quantity = 1; purchased through a distributor refers to Sales Channel = 'Distributor'; 'Harri County' is the County
SELECT SUM(CASE WHEN T1.`Order Quantity` = 1 AND T1.`Sales Channel` = 'Distributor' AND T2.County = 'Washtenaw County' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,694
2,694
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, County TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, "Order Quantity" INTEGER )
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
11
medium
{ "case_1": [ 127, 129, 158, 394, 479, 666, 909, 944, 975 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 362, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
What is the least purchased product by stores in the city of Santa Clarita?
least purchased product refers to Min(Count(Product Name)); 'Santa Clarita' is the City
SELECT T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.`City Name` = 'Santa Clarita' GROUP BY T1.`Product Name` ORDER BY COUNT(T1.`Product Name`) ASC LIMIT 1
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,695
2,695
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "ASC", "COUNT", "FROM" ]
14
medium
{ "case_1": [ -1 ], "case_2": [ -1 ], "case_3": [ 49, 126, 202, 247, 348, 394, 411, 909, 912, 918, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 4, 6, 11, 13, 15, 16, 20, 22, 27, 28, 29, 30, 36, 37, 47, 49, 51, 53, 55, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 82, 86, 88, 89, 91, 93, 96, 98, 106, 108, 113, 115, 117, 118, 119, 121, 125, 126, 131, 138, 140, 142, 143, 146, 148, 150, 152, 159, 160, 162, 163, 164, 167, 169, 170, 173, 175, 179, 183, 184, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 229, 233, 234, 239, 243, 244, 247, 252, 254, 256, 261, 262, 267, 268, 269, 275, 276, 277, 278, 281, 286, 299, 301, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 394, 395, 401, 403, 406, 409, 411, 412, 416, 417, 424, 426, 428, 429, 434, 435, 436, 444, 445, 448, 451, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 490, 493, 495, 497, 500, 505, 509, 515, 516, 519, 520, 526, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 552, 558, 559, 560, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 645, 646, 649, 651, 654, 657, 658, 659, 662, 663, 664, 665, 668, 669, 671, 681, 687, 688, 690, 691, 694, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 748, 749, 750, 751, 752, 753, 756, 759, 760, 762, 768, 769, 772, 778, 779, 787, 790, 796, 797, 799, 800, 802, 803, 804, 810, 812, 813, 814, 818, 819, 823, 824, 827, 830, 838, 839, 841, 849, 850, 851, 853, 857, 861, 866, 867, 869, 870, 874, 876, 877, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 909, 911, 912, 915, 917, 918, 922, 923, 924, 926, 927, 929, 930, 932, 934, 935, 943, 950, 951, 953, 954, 956, 958, 961, 962, 963, 966, 967, 969, 970, 972, 973, 975, 977, 981, 985, 986, 993, 994, 996, 1005, 1006, 1010, 1013, 1015, 1017, 1022, 1023, 1025, 1030, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1071, 1072, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1094, 1100, 1101, 1103, 1104, 1106, 1112, 1119, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
At what Latitude and Longitude is the store that has used the WARE-PUJ1005 warehouse the fewest times?
WARE-PUJ1005 is the WarehouseCode; fewest times refers to Min (Count(WarehouseCode))
SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.WarehouseCode = 'WARE-PUJ1005' GROUP BY T2.StoreID ORDER BY COUNT(T1.WarehouseCode) ASC LIMIT 1
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,696
2,696
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, Latitude REAL, Longitude REAL ) CREATE TABLE `Sales Orders` ( WarehouseCode TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "-", "INNER JOIN", "ON", "ASC", "COUNT", "FROM" ]
12
medium
{ "case_1": [ 158, 394, 909, 975 ], "case_2": [ 158, 394, 411, 909, 975 ], "case_3": [ 34, 49, 126, 158, 202, 247, 348, 394, 411, 805, 909, 912, 918, 975, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 6, 11, 13, 15, 16, 20, 21, 22, 27, 28, 29, 30, 34, 36, 37, 39, 42, 45, 47, 49, 51, 53, 55, 59, 62, 63, 68, 69, 73, 74, 75, 77, 78, 82, 85, 86, 88, 89, 91, 93, 96, 97, 98, 105, 106, 108, 112, 113, 115, 117, 118, 119, 121, 125, 126, 128, 131, 135, 138, 140, 141, 142, 143, 146, 148, 150, 152, 154, 158, 159, 160, 162, 163, 164, 167, 169, 170, 172, 173, 175, 179, 180, 183, 184, 187, 188, 189, 190, 191, 196, 197, 199, 200, 202, 206, 212, 213, 214, 225, 226, 227, 228, 229, 233, 234, 239, 240, 243, 244, 247, 252, 254, 256, 261, 262, 267, 268, 269, 272, 275, 276, 277, 278, 281, 286, 296, 299, 300, 301, 309, 311, 313, 314, 316, 317, 319, 320, 323, 324, 325, 329, 330, 334, 335, 336, 338, 339, 341, 342, 344, 345, 348, 349, 352, 353, 354, 356, 358, 359, 360, 364, 365, 368, 370, 371, 373, 374, 375, 378, 379, 381, 382, 383, 384, 385, 391, 392, 393, 394, 395, 401, 403, 406, 409, 411, 412, 416, 417, 424, 425, 426, 428, 429, 434, 435, 436, 444, 445, 446, 448, 451, 454, 460, 462, 464, 465, 467, 469, 471, 473, 476, 477, 478, 482, 484, 487, 488, 489, 490, 493, 495, 496, 497, 498, 500, 503, 505, 507, 509, 514, 515, 516, 519, 520, 522, 526, 529, 530, 532, 535, 536, 537, 538, 542, 544, 547, 548, 550, 552, 558, 559, 560, 562, 563, 564, 566, 567, 573, 578, 579, 580, 581, 582, 584, 586, 590, 592, 595, 596, 597, 606, 608, 611, 613, 620, 621, 624, 625, 626, 627, 630, 632, 633, 634, 637, 638, 641, 643, 645, 646, 647, 649, 651, 654, 657, 658, 659, 660, 662, 663, 664, 665, 668, 669, 671, 675, 677, 681, 684, 687, 688, 690, 691, 693, 694, 695, 696, 698, 701, 703, 705, 712, 714, 719, 720, 721, 727, 733, 734, 735, 736, 739, 740, 743, 746, 748, 749, 750, 751, 752, 753, 754, 756, 758, 759, 760, 762, 768, 769, 772, 777, 778, 779, 787, 788, 790, 796, 797, 799, 800, 802, 803, 804, 805, 810, 812, 813, 814, 818, 819, 823, 824, 827, 829, 830, 835, 838, 839, 841, 849, 850, 851, 853, 857, 858, 861, 866, 867, 869, 870, 874, 876, 877, 878, 882, 886, 888, 889, 891, 893, 896, 897, 898, 901, 902, 905, 909, 911, 912, 915, 917, 918, 922, 923, 924, 925, 926, 927, 929, 930, 932, 934, 935, 943, 950, 951, 953, 954, 956, 958, 959, 961, 962, 963, 966, 967, 969, 970, 972, 973, 974, 975, 977, 980, 981, 985, 986, 993, 994, 996, 1005, 1006, 1010, 1013, 1015, 1017, 1022, 1023, 1025, 1030, 1031, 1034, 1037, 1038, 1042, 1043, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1062, 1064, 1065, 1067, 1068, 1070, 1071, 1072, 1074, 1076, 1077, 1078, 1082, 1084, 1086, 1087, 1091, 1092, 1094, 1100, 1101, 1103, 1104, 1106, 1111, 1112, 1119, 1123, 1124, 1128, 1131, 1132, 1133, 1134, 1135, 1137 ] }
regional_sales
What percentage of sell orders on 04/04/2020 were for the state of New York?
sales order on 04/04/2020 refers to OrderDate = '4/4/20'; 'New York' is  the City Name; percentage = Divide (Sum(OrderNumber where City Name = 'New York'), Count (OrderNumber)) * 100
SELECT CAST(SUM(CASE WHEN T2.State = 'New York' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.OrderNumber) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.OrderDate = '4/4/20'
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,697
2,697
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID )
[ "CASE WHEN", "AS", "SELECT", "SUM", "/", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
14
medium
{ "case_1": [ 127, 129, 158, 394, 479, 666, 909, 944, 975 ], "case_2": [ 127, 129, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 126, 127, 129, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 528, 666, 672, 706, 744, 747, 805, 806, 832, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 4, 6, 11, 16, 22, 24, 27, 30, 35, 36, 37, 39, 42, 47, 51, 53, 55, 61, 62, 63, 64, 68, 69, 71, 73, 74, 75, 77, 81, 82, 83, 86, 87, 88, 91, 93, 94, 96, 97, 98, 104, 106, 112, 113, 115, 117, 118, 119, 120, 121, 125, 126, 127, 129, 131, 140, 141, 142, 143, 146, 148, 152, 153, 155, 158, 159, 160, 164, 167, 169, 170, 171, 173, 175, 179, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 196, 197, 199, 200, 201, 202, 206, 207, 212, 213, 214, 215, 219, 223, 225, 226, 227, 228, 229, 233, 234, 236, 243, 244, 247, 248, 254, 256, 258, 261, 264, 267, 268, 269, 271, 276, 277, 278, 279, 298, 299, 300, 301, 304, 311, 313, 314, 316, 317, 319, 320, 322, 323, 325, 330, 334, 335, 336, 338, 339, 341, 344, 345, 347, 349, 354, 356, 358, 360, 363, 364, 365, 370, 373, 374, 375, 378, 379, 381, 382, 383, 384, 391, 392, 393, 394, 398, 401, 402, 403, 406, 409, 411, 412, 415, 416, 417, 423, 424, 426, 427, 436, 438, 444, 445, 448, 450, 451, 452, 453, 454, 458, 460, 462, 464, 465, 467, 469, 470, 471, 473, 476, 477, 478, 479, 483, 484, 485, 486, 487, 488, 490, 493, 500, 504, 505, 509, 510, 514, 515, 516, 517, 518, 519, 520, 526, 528, 532, 535, 536, 537, 538, 540, 544, 547, 548, 550, 552, 558, 559, 560, 563, 564, 566, 571, 573, 575, 579, 580, 581, 582, 595, 596, 597, 606, 608, 609, 611, 612, 613, 620, 623, 627, 628, 630, 632, 633, 634, 636, 637, 638, 640, 641, 645, 646, 649, 650, 654, 658, 659, 662, 663, 665, 666, 668, 669, 671, 672, 676, 681, 682, 686, 687, 688, 690, 694, 695, 696, 701, 705, 706, 710, 712, 714, 717, 721, 723, 727, 733, 734, 735, 736, 739, 740, 743, 744, 745, 747, 749, 750, 752, 753, 754, 756, 760, 762, 768, 769, 772, 776, 777, 778, 779, 787, 788, 790, 795, 796, 797, 798, 799, 800, 802, 804, 805, 806, 808, 810, 812, 813, 814, 818, 819, 823, 824, 825, 827, 830, 832, 838, 839, 841, 844, 848, 849, 851, 853, 857, 866, 867, 868, 870, 871, 874, 876, 877, 880, 886, 888, 893, 894, 896, 897, 898, 901, 902, 909, 911, 912, 913, 915, 917, 918, 922, 923, 924, 926, 927, 930, 934, 935, 941, 943, 944, 950, 951, 954, 956, 958, 959, 961, 962, 963, 969, 973, 975, 977, 981, 985, 986, 993, 996, 998, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1022, 1023, 1027, 1031, 1037, 1038, 1042, 1043, 1047, 1050, 1051, 1058, 1062, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1082, 1084, 1086, 1087, 1092, 1094, 1098, 1100, 1101, 1103, 1104, 1106, 1112, 1119, 1121, 1123, 1124, 1128, 1131, 1133, 1134, 1135, 1137 ] }
regional_sales
What is the average land area of ​​the cities in which stores that purchased products for a unit price of 998.30 are located?
average land area = Divide (Sum(Land Area), Count(Land Area))
SELECT AVG(T2.`Land Area`) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.`Unit Price` = '998.30'
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,698
2,698
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, "Land Area" INTEGER ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, "Unit Price" TEXT )
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
7
simple
{ "case_1": [ 139 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
What is the average household income in cities in the state of New Hampshire where there are stores of the type city?
"New Hampshire" is the State; average household income = AVG(Household Income)
SELECT AVG(T2.`Household Income`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T2.State = 'New Hampshire' AND T2.Type = 'City'
CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,699
2,699
CREATE TABLE `Regions` ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE `Store Locations` ( StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT, Type TEXT, "Household Income" INTEGER )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
8
simple
{ "case_1": [ -1 ], "case_2": [ 171, 672, 706 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 864, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1081, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
How many sales teams are there in the Midwest?
"Midwest" is the Region
SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,700
2,700
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT )
[ "CASE WHEN", "SELECT", "SUM", "CASE", "FROM" ]
5
simple
{ "case_1": [ 978 ], "case_2": [ 978 ], "case_3": [ 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 744, 747, 805, 832, 844, 880, 909, 912, 944, 978, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 6, 16, 24, 35, 39, 42, 54, 61, 64, 71, 77, 81, 83, 87, 93, 94, 104, 106, 112, 113, 120, 122, 127, 129, 141, 148, 152, 153, 155, 158, 169, 171, 173, 184, 186, 189, 191, 192, 195, 201, 205, 207, 212, 213, 215, 219, 223, 225, 226, 228, 234, 236, 245, 248, 254, 258, 261, 263, 264, 267, 271, 279, 285, 298, 299, 300, 303, 304, 305, 313, 316, 317, 322, 323, 335, 347, 350, 356, 360, 362, 363, 365, 375, 378, 379, 381, 383, 393, 398, 402, 406, 409, 412, 415, 423, 427, 438, 443, 448, 450, 452, 453, 458, 470, 476, 478, 479, 483, 485, 486, 487, 488, 500, 504, 506, 508, 510, 514, 517, 518, 527, 528, 535, 537, 540, 547, 550, 563, 564, 571, 573, 575, 579, 580, 581, 597, 601, 609, 612, 620, 623, 628, 630, 638, 640, 646, 650, 658, 662, 666, 672, 676, 682, 686, 690, 695, 701, 706, 709, 710, 717, 723, 740, 744, 745, 747, 750, 753, 762, 772, 776, 777, 787, 788, 795, 796, 798, 800, 802, 805, 808, 810, 813, 823, 825, 827, 832, 841, 844, 848, 868, 870, 871, 872, 874, 880, 894, 896, 909, 912, 913, 922, 924, 926, 929, 939, 941, 943, 944, 958, 959, 962, 973, 978, 979, 985, 987, 998, 1008, 1012, 1023, 1027, 1031, 1036, 1038, 1048, 1062, 1064, 1066, 1068, 1069, 1078, 1082, 1087, 1092, 1093, 1098, 1100, 1110, 1121, 1129, 1131, 1133, 1134, 1135 ] }
regional_sales
Indicate order numbers with an order date after 1/1/2018.
order date after 1/1/2018 refers to OrderDate > '1/1/2018'
SELECT DISTINCT T FROM ( SELECT CASE WHEN OrderDate > '1/1/18' THEN OrderNumber ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,701
2,701
CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT )
[ "AS", "SELECT", "/", "CASE", "NULL", "NOT", "IS", "FROM" ]
12
medium
{ "case_1": [ 601 ], "case_2": [ 92, 601 ], "case_3": [ 92, 129, 158, 171, 258, 263, 298, 303, 305, 398, 443, 479, 528, 601, 672, 706, 724, 805, 837, 844, 880, 978, 982, 1066 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 16, 42, 53, 67, 92, 106, 129, 138, 148, 150, 152, 158, 171, 195, 200, 258, 263, 267, 298, 299, 303, 305, 375, 393, 395, 398, 402, 406, 423, 436, 443, 458, 476, 478, 479, 485, 493, 508, 514, 516, 522, 528, 533, 573, 589, 601, 620, 637, 646, 672, 706, 712, 724, 772, 805, 837, 844, 880, 894, 926, 927, 935, 941, 978, 982, 985, 1014, 1020, 1036, 1048, 1059, 1062, 1066, 1069, 1129, 1131, 1133, 1134 ] }
regional_sales
How many sales channels does the sales team have in the Midwest?
"Midwest" is the Region
SELECT COUNT(T1.`Sales Channel`) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest'
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,702
2,702
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID )
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
7
simple
{ "case_1": [ -1 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 303, 394, 398, 411, 438, 443, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Which sales team has the other with the highest unit price?
highest unit price refers to Max(Unit Price)
SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE REPLACE(T1.`Unit Price`, ',', '') = ( SELECT REPLACE(T1.`Unit Price`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,703
2,703
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT ) CREATE TABLE `Sales Orders` ( _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, "Unit Price" TEXT )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
18
challenging
{ "case_1": [ 1128 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
Which regions have online sales channels that have the most discounts?
most discount refers to Max(Discount Applied)
SELECT T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.`Sales Channel` = 'Online' ORDER BY T1.`Discount Applied` DESC LIMIT 1
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,704
2,704
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, "Discount Applied" REAL )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
9
simple
{ "case_1": [ -1 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
Which Apollo Ltd customer's order number has the most expensive unit price, indicating the order date?
"Apollo Ltd" is the Customer Names; most expensive unit price refers to max(Unit Price)
SELECT T1.OrderNumber, T1.OrderDate FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Apollo Ltd' ORDER BY T1.`Unit Price` DESC LIMIT 1
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,705
2,705
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, OrderDate TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, "Unit Price" TEXT )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
9
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
Provide order number, warehouse code of customers Elorac, Corp.
"Elorac, Corp" is the Customer Names
SELECT DISTINCT T1.OrderNumber, T1.WarehouseCode FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Elorac, Corp'
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,706
2,706
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Sales Orders` ( CREATE TABLE "Sales Orders" OrderNumber TEXT constraint "Sales Orders_pk" primary key, WarehouseCode TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID )
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{ "case_1": [ 49, 153 ], "case_2": [ 49, 126, 153, 219, 258, 747, 844 ], "case_3": [ 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 35, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 286, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 506, 507, 508, 509, 510, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 657, 658, 659, 660, 661, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 978, 980, 981, 982, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1074, 1075, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Name of customers who have ordered Cocktail Glasses by online sales channel.
"Cocktail Glasses" is the Product Name; customer refers to Customer Names
SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.`Product Name` = 'Cocktail Glasses' AND T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T IS NOT NULL
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,707
2,707
CREATE TABLE `Customers` ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Sales Orders` ( "Sales Channel" TEXT, _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references CustomersCustomerID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID )
[ "AS", "AND", "SELECT", "CASE", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
14
medium
{ "case_1": [ 806 ], "case_2": [ 806 ], "case_3": [ 92, 126, 127, 129, 153, 158, 171, 219, 258, 263, 264, 298, 303, 305, 398, 438, 443, 479, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 944, 978, 982, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 4, 5, 6, 7, 8, 12, 16, 19, 20, 21, 22, 24, 26, 30, 33, 37, 39, 42, 44, 45, 47, 51, 52, 53, 57, 63, 64, 66, 67, 68, 69, 71, 73, 74, 75, 76, 77, 81, 85, 88, 90, 92, 93, 95, 96, 98, 99, 106, 111, 112, 113, 115, 116, 117, 118, 119, 120, 125, 126, 127, 128, 129, 131, 138, 141, 142, 143, 144, 146, 148, 150, 152, 153, 154, 155, 158, 160, 163, 164, 169, 170, 171, 172, 175, 176, 177, 180, 183, 184, 187, 191, 195, 197, 200, 201, 207, 212, 214, 219, 225, 226, 227, 234, 236, 239, 240, 244, 248, 256, 258, 261, 262, 263, 264, 265, 266, 267, 268, 272, 275, 276, 277, 278, 279, 282, 296, 298, 299, 300, 301, 303, 304, 305, 314, 315, 317, 319, 322, 325, 330, 335, 339, 341, 347, 356, 360, 361, 368, 370, 374, 375, 376, 382, 383, 385, 391, 393, 395, 398, 402, 403, 405, 406, 408, 412, 413, 414, 415, 416, 417, 419, 424, 425, 426, 427, 428, 433, 436, 437, 438, 440, 443, 444, 446, 448, 451, 452, 455, 463, 464, 469, 470, 475, 476, 477, 478, 479, 480, 482, 486, 490, 493, 494, 496, 497, 498, 500, 507, 508, 514, 515, 516, 518, 519, 520, 522, 524, 526, 528, 529, 530, 533, 535, 537, 539, 540, 541, 544, 547, 550, 557, 558, 559, 561, 562, 563, 564, 571, 573, 575, 580, 581, 582, 584, 586, 588, 589, 595, 601, 605, 608, 610, 612, 613, 615, 620, 623, 624, 625, 626, 627, 628, 632, 633, 637, 640, 641, 643, 646, 648, 651, 662, 663, 666, 668, 671, 672, 675, 676, 677, 678, 682, 683, 684, 685, 686, 687, 690, 693, 697, 699, 702, 706, 710, 712, 714, 715, 723, 724, 726, 727, 734, 735, 739, 740, 741, 743, 744, 746, 747, 749, 753, 754, 756, 758, 760, 762, 763, 765, 767, 768, 772, 773, 775, 776, 777, 780, 783, 787, 788, 793, 796, 797, 799, 800, 804, 805, 806, 807, 808, 810, 814, 819, 824, 825, 827, 829, 830, 832, 835, 837, 838, 841, 844, 848, 849, 851, 853, 858, 859, 860, 861, 867, 868, 870, 871, 873, 874, 877, 878, 879, 880, 886, 888, 892, 894, 895, 896, 902, 905, 907, 909, 912, 917, 922, 923, 924, 926, 927, 928, 930, 931, 932, 935, 941, 943, 944, 949, 953, 954, 956, 958, 959, 961, 969, 974, 978, 982, 985, 986, 991, 996, 1000, 1001, 1012, 1014, 1017, 1019, 1020, 1022, 1023, 1027, 1031, 1036, 1039, 1042, 1044, 1046, 1048, 1058, 1059, 1061, 1062, 1063, 1064, 1066, 1067, 1068, 1069, 1071, 1072, 1078, 1080, 1082, 1084, 1086, 1087, 1092, 1098, 1100, 1101, 1103, 1104, 1105, 1109, 1115, 1119, 1123, 1128, 1129, 1131, 1133, 1134, 1135, 1136 ] }
regional_sales
Which store in Arizona has the most net profit?
"Arizona" is the name of State; most net profit = Max(Subtract( Unit Price, Unit Cost))
SELECT T2.StoreID FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T2.State = 'Arizona' ORDER BY T1.`Unit Price` - T1.`Unit Cost` DESC LIMIT 1
CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,708
2,708
CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, "Unit Price" TEXT, "Unit Cost" TEXT )
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
9
simple
{ "case_1": [ 139 ], "case_2": [ 127, 129, 139, 158, 394, 411, 479, 666, 909, 944, 975 ], "case_3": [ 17, 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 348, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1077, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 33, 34, 36, 37, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 108, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 175, 176, 177, 179, 180, 181, 183, 184, 185, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 208, 211, 212, 213, 214, 217, 218, 219, 220, 221, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 252, 254, 256, 257, 258, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 285, 286, 287, 289, 290, 291, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 352, 353, 354, 356, 357, 358, 359, 360, 361, 363, 364, 365, 368, 369, 370, 371, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 544, 547, 548, 550, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 619, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 664, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 708, 710, 711, 712, 714, 715, 717, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 732, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 815, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 836, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 869, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 934, 935, 936, 937, 938, 940, 943, 944, 946, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 972, 973, 974, 975, 977, 980, 981, 983, 985, 986, 987, 988, 991, 993, 994, 996, 997, 999, 1000, 1001, 1003, 1004, 1005, 1006, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1030, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1057, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1076, 1077, 1078, 1080, 1082, 1083, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1139, 1141 ] }
regional_sales
How much more is the Florida store's computer product unit price than the Texas store?
"Florida" and "Texas" are both the name of State; Computer product refers to Product Name = 'Computers; difference in unit price = Subtract (Unit Price where State = 'Florida', Unit Price where State = 'Texas')
SELECT SUM(CASE WHEN T3.State = 'Florida' THEN T2.`Unit Price` ELSE 0 END) - SUM(CASE WHEN T3.State = 'Texas' THEN T2.`Unit Price` ELSE 0 END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T1.`Product Name` = 'Computers'
CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,709
2,709
CREATE TABLE `Products` ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE `Store Locations` ( CREATE TABLE "Store Locations" StoreID INTEGER constraint "Store Locations_pk" primary key, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references RegionsStateCode, State TEXT ) CREATE TABLE `Sales Orders` ( _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"StoreID, _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references ProductsProductID, "Unit Price" TEXT )
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
15
medium
{ "case_1": [ -1 ], "case_2": [ 264, 528, 744 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 394, 398, 411, 438, 479, 499, 528, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 3, 4, 5, 6, 7, 8, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 57, 58, 59, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 104, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 175, 176, 177, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, 197, 199, 200, 201, 202, 205, 206, 207, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 271, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 504, 505, 507, 508, 509, 511, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 709, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 795, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 979, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1093, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1110, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1122, 1123, 1124, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }
regional_sales
Among sales teams in Midwest region, which sales team has an order quantity greater than 5?
order quantity greater than 5 refers to Order Quantity > 5
SELECT DISTINCT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest' AND T1.`Order Quantity` > 5
CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ) CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ) CREATE TABLE Regions ( StateCode TEXT constraint Regions_pk primary key, State TEXT, Region TEXT ) CREATE TABLE "Sales Team" ( SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE "Store Locations" ( StoreID INTEGER constraint "Store Locations_pk" primary key, "City Name" TEXT, County TEXT, StateCode TEXT constraint "Store Locations_Regions_StateCode_fk" references Regions(StateCode), State TEXT, Type TEXT, Latitude REAL, Longitude REAL, AreaCode INTEGER, Population INTEGER, "Household Income" INTEGER, "Median Income" INTEGER, "Land Area" INTEGER, "Water Area" INTEGER, "Time Zone" TEXT ) CREATE TABLE "Sales Orders" ( OrderNumber TEXT constraint "Sales Orders_pk" primary key, "Sales Channel" TEXT, WarehouseCode TEXT, ProcuredDate TEXT, OrderDate TEXT, ShipDate TEXT, DeliveryDate TEXT, CurrencyCode TEXT, _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"(SalesTeamID), _CustomerID INTEGER constraint "Sales Orders_Customers_CustomerID_fk" references Customers(CustomerID), _StoreID INTEGER constraint "Sales Orders_Store Locations_StoreID_fk" references "Store Locations"(StoreID), _ProductID INTEGER constraint "Sales Orders_Products_ProductID_fk" references Products(ProductID), "Order Quantity" INTEGER, "Discount Applied" REAL, "Unit Price" TEXT, "Unit Cost" TEXT )
na
2,710
2,710
CREATE TABLE `Sales Team` ( CREATE TABLE "Sales Team" SalesTeamID INTEGER constraint "Sales Team_pk" primary key, "Sales Team" TEXT, Region TEXT ) CREATE TABLE `Sales Orders` ( _SalesTeamID INTEGER constraint "Sales Orders_Sales Team_SalesTeamID_fk" references "Sales Team"SalesTeamID, "Order Quantity" INTEGER )
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{ "case_1": [ -1 ], "case_2": [ 247, 298, 912, 918, 1066, 1128 ], "case_3": [ 34, 49, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 264, 298, 305, 394, 398, 411, 438, 479, 499, 528, 601, 666, 672, 706, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 1066, 1128 ], "case_4": [ 17, 34, 49, 92, 126, 127, 129, 139, 153, 158, 171, 202, 219, 247, 258, 263, 264, 298, 303, 305, 348, 394, 398, 411, 438, 443, 479, 499, 528, 601, 666, 672, 706, 708, 724, 744, 747, 805, 806, 832, 837, 844, 880, 909, 912, 918, 944, 975, 978, 982, 1066, 1077, 1128 ], "case_5": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 20, 21, 22, 23, 24, 26, 27, 29, 30, 33, 34, 36, 37, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 55, 57, 58, 59, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 88, 90, 91, 93, 94, 95, 96, 97, 98, 99, 101, 102, 105, 106, 107, 111, 112, 113, 115, 116, 117, 118, 119, 120, 121, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 148, 150, 151, 152, 153, 154, 155, 158, 159, 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 175, 176, 177, 178, 179, 180, 183, 184, 186, 187, 188, 189, 190, 191, 194, 195, 196, 197, 199, 200, 201, 202, 206, 207, 211, 212, 213, 214, 217, 218, 219, 220, 221, 223, 225, 226, 227, 228, 229, 232, 233, 234, 235, 236, 239, 240, 241, 242, 243, 244, 246, 247, 248, 250, 254, 256, 257, 258, 260, 261, 262, 264, 265, 266, 267, 268, 269, 272, 275, 276, 277, 278, 279, 280, 281, 282, 284, 287, 289, 290, 292, 295, 296, 297, 298, 299, 300, 301, 302, 304, 305, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 329, 330, 333, 334, 335, 336, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 349, 353, 354, 356, 357, 358, 360, 361, 363, 364, 365, 367, 368, 369, 370, 373, 374, 375, 376, 378, 379, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 401, 402, 403, 405, 406, 407, 408, 409, 411, 412, 413, 414, 415, 416, 417, 419, 422, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 440, 441, 444, 445, 446, 447, 448, 449, 450, 451, 452, 454, 455, 456, 457, 459, 460, 462, 463, 464, 465, 467, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 482, 483, 484, 486, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 498, 499, 500, 501, 503, 505, 507, 509, 510, 511, 514, 515, 516, 518, 519, 520, 521, 522, 523, 524, 526, 528, 529, 530, 532, 533, 535, 536, 537, 538, 539, 540, 541, 544, 547, 548, 550, 552, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 569, 570, 571, 572, 573, 574, 575, 577, 578, 579, 580, 581, 582, 584, 586, 587, 588, 589, 590, 592, 593, 595, 596, 597, 600, 601, 602, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 620, 621, 623, 624, 625, 626, 627, 628, 630, 631, 632, 633, 634, 636, 637, 638, 639, 640, 641, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 654, 655, 657, 658, 659, 660, 662, 663, 665, 666, 668, 669, 670, 671, 672, 674, 675, 676, 677, 678, 681, 682, 683, 684, 685, 686, 687, 688, 690, 691, 693, 694, 695, 696, 697, 699, 700, 701, 702, 704, 705, 706, 710, 711, 712, 714, 715, 717, 720, 721, 722, 723, 724, 725, 726, 727, 728, 733, 734, 735, 736, 739, 740, 741, 742, 743, 744, 745, 746, 747, 749, 750, 751, 752, 753, 754, 755, 756, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 786, 787, 788, 790, 792, 793, 796, 797, 798, 799, 800, 802, 803, 804, 805, 806, 807, 808, 809, 810, 812, 813, 814, 818, 819, 822, 823, 824, 825, 827, 828, 829, 830, 832, 833, 834, 835, 837, 838, 839, 841, 844, 845, 846, 848, 849, 850, 851, 852, 853, 854, 857, 858, 859, 860, 861, 862, 863, 866, 867, 868, 870, 871, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 885, 886, 887, 888, 889, 891, 892, 893, 894, 895, 896, 897, 898, 900, 901, 902, 904, 905, 907, 908, 909, 910, 911, 912, 914, 915, 916, 917, 918, 922, 923, 924, 925, 926, 927, 928, 930, 931, 932, 934, 935, 936, 937, 938, 940, 941, 943, 944, 949, 950, 951, 952, 953, 954, 956, 958, 959, 961, 962, 963, 964, 966, 967, 969, 970, 971, 973, 974, 975, 977, 980, 981, 985, 986, 988, 991, 993, 994, 996, 997, 998, 999, 1000, 1001, 1003, 1005, 1006, 1008, 1010, 1011, 1012, 1013, 1015, 1016, 1017, 1019, 1022, 1023, 1025, 1027, 1029, 1031, 1033, 1034, 1035, 1037, 1038, 1039, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1049, 1050, 1051, 1052, 1056, 1058, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1071, 1072, 1074, 1078, 1080, 1082, 1084, 1085, 1086, 1087, 1089, 1091, 1092, 1094, 1095, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1106, 1109, 1111, 1112, 1114, 1115, 1116, 1118, 1119, 1121, 1122, 1123, 1124, 1128, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137 ] }