cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.12k stars 3.81k forks source link

sql: inconsistent ordering when using LIMIT #110707

Closed giangpham712 closed 1 year ago

giangpham712 commented 1 year ago

Describe the problem

Given a table

CREATE TABLE public."Orders" (
  "OrderID" INT4 NOT NULL DEFAULT nextval('public."Orders_OrderID_seq"'::REGCLASS),
  "CustomerID" CHAR(5) NULL,
  "EmployeeID" INT4 NULL,
  "OrderDate" TIMESTAMP NULL,
  "RequiredDate" TIMESTAMP NULL,
  "ShippedDate" TIMESTAMP NULL,
  "ShipVia" INT4 NULL,
  "Freight" DECIMAL(12,2) NULL DEFAULT 0:::DECIMAL,
  "ShipName" VARCHAR(40) NULL,
  "ShipAddress" VARCHAR(60) NULL,
  "ShipCity" VARCHAR(15) NULL,
  "ShipRegion" VARCHAR(15) NULL,
  "ShipPostalCode" VARCHAR(10) NULL,
  "ShipCountry" VARCHAR(15) NULL,
  CONSTRAINT "PK_Orders" PRIMARY KEY ("OrderID" ASC)
)

with some data

INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10248,'VINET',5,'1996-7-4','1996-8-1','1996-7-16',3,32.38,
    'Vins et alcools Chevalier','59 rue de l''Abbaye','Reims',
    NULL,'51100','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10249,'TOMSP',6,'1996-7-5','1996-8-16','1996-7-10',1,11.61,
    'Toms Spezialitäten','Luisenstr. 48','Münster',
    NULL,'44087','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10250,'HANAR',4,'1996-7-8','1996-8-5','1996-7-12',2,65.83,
    'Hanari Carnes','Rua do Paço, 67','Rio de Janeiro',
    'RJ','05454-876','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10251,'VICTE',3,'1996-7-8','1996-8-5','1996-7-15',1,41.34,
    'Victuailles en stock','2, rue du Commerce','Lyon',
    NULL,'69004','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10252,'SUPRD',4,'1996-7-9','1996-8-6','1996-7-11',2,51.30,
    'Suprêmes délices','Boulevard Tirou, 255','Charleroi',
    NULL,'B-6000','Belgium');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10253,'HANAR',3,'1996-7-10','1996-7-24','1996-7-16',2,58.17,
    'Hanari Carnes','Rua do Paço, 67','Rio de Janeiro',
    'RJ','05454-876','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10254,'CHOPS',5,'1996-7-11','1996-8-8','1996-7-23',2,22.98,
    'Chop-suey Chinese','Hauptstr. 31','Bern',
    NULL,'3012','Switzerland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10255,'RICSU',9,'1996-7-12','1996-8-9','1996-7-15',3,148.33,
    'Richter Supermarkt','Starenweg 5','Genève',
    NULL,'1204','Switzerland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10256,'WELLI',3,'1996-7-15','1996-8-12','1996-7-17',2,13.97,
    'Wellington Importadora','Rua do Mercado, 12','Resende',
    'SP','08737-363','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10257,'HILAA',4,'1996-7-16','1996-8-13','1996-7-22',3,81.91,
    'HILARION-Abastos','Carrera 22 con Ave. Carlos Soublette #8-35','San Cristóbal',
    'Táchira','5022','Venezuela');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10258,'ERNSH',1,'1996-7-17','1996-8-14','1996-7-23',1,140.51,
    'Ernst Handel','Kirchgasse 6','Graz',
    NULL,'8010','Austria');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10259,'CENTC',4,'1996-7-18','1996-8-15','1996-7-25',3,3.25,
    'Centro comercial Moctezuma','Sierras de Granada 9993','México D.F.',
    NULL,'05022','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10260,'OTTIK',4,'1996-7-19','1996-8-16','1996-7-29',1,55.09,
    'Ottilies Käseladen','Mehrheimerstr. 369','Köln',
    NULL,'50739','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10261,'QUEDE',4,'1996-7-19','1996-8-16','1996-7-30',2,3.05,
    'Que Delícia','Rua da Panificadora, 12','Rio de Janeiro',
    'RJ','02389-673','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10262,'RATTC',8,'1996-7-22','1996-8-19','1996-7-25',3,48.29,
    'Rattlesnake Canyon Grocery','2817 Milton Dr.','Albuquerque',
    'NM','87110','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10263,'ERNSH',9,'1996-7-23','1996-8-20','1996-7-31',3,146.06,
    'Ernst Handel','Kirchgasse 6','Graz',
    NULL,'8010','Austria');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10264,'FOLKO',6,'1996-7-24','1996-8-21','1996-8-23',3,3.67,
    'Folk och fä HB','Åkergatan 24','Bräcke',
    NULL,'S-844 67','Sweden');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10265,'BLONP',2,'1996-7-25','1996-8-22','1996-8-12',1,55.28,
    'Blondel père et fils','24, place Kléber','Strasbourg',
    NULL,'67000','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10266,'WARTH',3,'1996-7-26','1996-9-6','1996-7-31',3,25.73,
    'Wartian Herkku','Torikatu 38','Oulu',
    NULL,'90110','Finland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10267,'FRANK',4,'1996-7-29','1996-8-26','1996-8-6',1,208.58,
    'Frankenversand','Berliner Platz 43','München',
    NULL,'80805','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10268,'GROSR',8,'1996-7-30','1996-8-27','1996-8-2',3,66.29,
    'GROSELLA-Restaurante','5ª Ave. Los Palos Grandes','Caracas',
    'DF','1081','Venezuela');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10269,'WHITC',5,'1996-7-31','1996-8-14','1996-8-9',1,4.56,
    'White Clover Markets','1029 - 12th Ave. S.','Seattle',
    'WA','98124','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10270,'WARTH',1,'1996-8-1','1996-8-29','1996-8-2',1,136.54,
    'Wartian Herkku','Torikatu 38','Oulu',
    NULL,'90110','Finland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10271,'SPLIR',6,'1996-8-1','1996-8-29','1996-8-30',2,4.54,
    'Split Rail Beer & Ale','P.O. Box 555','Lander',
    'WY','82520','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10272,'RATTC',6,'1996-8-2','1996-8-30','1996-8-6',2,98.03,
    'Rattlesnake Canyon Grocery','2817 Milton Dr.','Albuquerque',
    'NM','87110','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10273,'QUICK',3,'1996-8-5','1996-9-2','1996-8-12',3,76.07,
    'QUICK-Stop','Taucherstraße 10','Cunewalde',
    NULL,'01307','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10274,'VINET',6,'1996-8-6','1996-9-3','1996-8-16',1,6.01,
    'Vins et alcools Chevalier','59 rue de l''Abbaye','Reims',
    NULL,'51100','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10275,'MAGAA',1,'1996-8-7','1996-9-4','1996-8-9',1,26.93,
    'Magazzini Alimentari Riuniti','Via Ludovico il Moro 22','Bergamo',
    NULL,'24100','Italy');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10276,'TORTU',8,'1996-8-8','1996-8-22','1996-8-14',3,13.84,
    'Tortuga Restaurante','Avda. Azteca 123','México D.F.',
    NULL,'05033','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10277,'MORGK',2,'1996-8-9','1996-9-6','1996-8-13',3,125.77,
    'Morgenstern Gesundkost','Heerstr. 22','Leipzig',
    NULL,'04179','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10278,'BERGS',8,'1996-8-12','1996-9-9','1996-8-16',2,92.69,
    'Berglunds snabbköp','Berguvsvägen  8','Luleå',
    NULL,'S-958 22','Sweden');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10279,'LEHMS',8,'1996-8-13','1996-9-10','1996-8-16',2,25.83,
    'Lehmanns Marktstand','Magazinweg 7','Frankfurt a.M.',
    NULL,'60528','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10280,'BERGS',2,'1996-8-14','1996-9-11','1996-9-12',1,8.98,
    'Berglunds snabbköp','Berguvsvägen  8','Luleå',
    NULL,'S-958 22','Sweden');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10281,'ROMEY',4,'1996-8-14','1996-8-28','1996-8-21',1,2.94,
    'Romero y tomillo','Gran Vía, 1','Madrid',
    NULL,'28001','Spain');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10282,'ROMEY',4,'1996-8-15','1996-9-12','1996-8-21',1,12.69,
    'Romero y tomillo','Gran Vía, 1','Madrid',
    NULL,'28001','Spain');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10283,'LILAS',3,'1996-8-16','1996-9-13','1996-8-23',3,84.81,
    'LILA-Supermercado','Carrera 52 con Ave. Bolívar #65-98 Llano Largo','Barquisimeto',
    'Lara','3508','Venezuela');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10284,'LEHMS',4,'1996-8-19','1996-9-16','1996-8-27',1,76.56,
    'Lehmanns Marktstand','Magazinweg 7','Frankfurt a.M.',
    NULL,'60528','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10285,'QUICK',1,'1996-8-20','1996-9-17','1996-8-26',2,76.83,
    'QUICK-Stop','Taucherstraße 10','Cunewalde',
    NULL,'01307','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10286,'QUICK',8,'1996-8-21','1996-9-18','1996-8-30',3,229.24,
    'QUICK-Stop','Taucherstraße 10','Cunewalde',
    NULL,'01307','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10287,'RICAR',8,'1996-8-22','1996-9-19','1996-8-28',3,12.76,
    'Ricardo Adocicados','Av. Copacabana, 267','Rio de Janeiro',
    'RJ','02389-890','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10288,'REGGC',4,'1996-8-23','1996-9-20','1996-9-3',1,7.45,
    'Reggiani Caseifici','Strada Provinciale 124','Reggio Emilia',
    NULL,'42100','Italy');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10289,'BSBEV',7,'1996-8-26','1996-9-23','1996-8-28',3,22.77,
    'B''s Beverages','Fauntleroy Circus','London',
    NULL,'EC2 5NT','UK');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10290,'COMMI',8,'1996-8-27','1996-9-24','1996-9-3',1,79.70,
    'Comércio Mineiro','Av. dos Lusíadas, 23','Sao Paulo',
    'SP','05432-043','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10291,'QUEDE',6,'1996-8-27','1996-9-24','1996-9-4',2,6.40,
    'Que Delícia','Rua da Panificadora, 12','Rio de Janeiro',
    'RJ','02389-673','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10292,'TRADH',1,'1996-8-28','1996-9-25','1996-9-2',2,1.35,
    'Tradiçao Hipermercados','Av. Inês de Castro, 414','Sao Paulo',
    'SP','05634-030','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10293,'TORTU',1,'1996-8-29','1996-9-26','1996-9-11',3,21.18,
    'Tortuga Restaurante','Avda. Azteca 123','México D.F.',
    NULL,'05033','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10294,'RATTC',4,'1996-8-30','1996-9-27','1996-9-5',2,147.26,
    'Rattlesnake Canyon Grocery','2817 Milton Dr.','Albuquerque',
    'NM','87110','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10295,'VINET',2,'1996-9-2','1996-9-30','1996-9-10',2,1.15,
    'Vins et alcools Chevalier','59 rue de l''Abbaye','Reims',
    NULL,'51100','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10296,'LILAS',6,'1996-9-3','1996-10-1','1996-9-11',1,0.12,
    'LILA-Supermercado','Carrera 52 con Ave. Bolívar #65-98 Llano Largo','Barquisimeto',
    'Lara','3508','Venezuela');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10297,'BLONP',5,'1996-9-4','1996-10-16','1996-9-10',2,5.74,
    'Blondel père et fils','24, place Kléber','Strasbourg',
    NULL,'67000','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10298,'HUNGO',6,'1996-9-5','1996-10-3','1996-9-11',2,168.22,
    'Hungry Owl All-Night Grocers','8 Johnstown Road','Cork',
    'Co. Cork',NULL,'Ireland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10299,'RICAR',4,'1996-9-6','1996-10-4','1996-9-13',2,29.76,
    'Ricardo Adocicados','Av. Copacabana, 267','Rio de Janeiro',
    'RJ','02389-890','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10300,'MAGAA',2,'1996-9-9','1996-10-7','1996-9-18',2,17.68,
    'Magazzini Alimentari Riuniti','Via Ludovico il Moro 22','Bergamo',
    NULL,'24100','Italy');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10301,'WANDK',8,'1996-9-9','1996-10-7','1996-9-17',2,45.08,
    'Die Wandernde Kuh','Adenauerallee 900','Stuttgart',
    NULL,'70563','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10302,'SUPRD',4,'1996-9-10','1996-10-8','1996-10-9',2,6.27,
    'Suprêmes délices','Boulevard Tirou, 255','Charleroi',
    NULL,'B-6000','Belgium');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10303,'GODOS',7,'1996-9-11','1996-10-9','1996-9-18',2,107.83,
    'Godos Cocina Típica','C/ Romero, 33','Sevilla',
    NULL,'41101','Spain');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10304,'TORTU',1,'1996-9-12','1996-10-10','1996-9-17',2,63.79,
    'Tortuga Restaurante','Avda. Azteca 123','México D.F.',
    NULL,'05033','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10305,'OLDWO',8,'1996-9-13','1996-10-11','1996-10-9',3,257.62,
    'Old World Delicatessen','2743 Bering St.','Anchorage',
    'AK','99508','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10306,'ROMEY',1,'1996-9-16','1996-10-14','1996-9-23',3,7.56,
    'Romero y tomillo','Gran Vía, 1','Madrid',
    NULL,'28001','Spain');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10307,'LONEP',2,'1996-9-17','1996-10-15','1996-9-25',2,0.56,
    'Lonesome Pine Restaurant','89 Chiaroscuro Rd.','Portland',
    'OR','97219','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10308,'ANATR',7,'1996-9-18','1996-10-16','1996-9-24',3,1.61,
    'Ana Trujillo Emparedados y helados','Avda. de la Constitución 2222','México D.F.',
    NULL,'05021','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10309,'HUNGO',3,'1996-9-19','1996-10-17','1996-10-23',1,47.30,
    'Hungry Owl All-Night Grocers','8 Johnstown Road','Cork',
    'Co. Cork',NULL,'Ireland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10310,'THEBI',8,'1996-9-20','1996-10-18','1996-9-27',2,17.52,
    'The Big Cheese','89 Jefferson Way Suite 2','Portland',
    'OR','97201','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10311,'DUMON',1,'1996-9-20','1996-10-4','1996-9-26',3,24.69,
    'Du monde entier','67, rue des Cinquante Otages','Nantes',
    NULL,'44000','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10312,'WANDK',2,'1996-9-23','1996-10-21','1996-10-3',2,40.26,
    'Die Wandernde Kuh','Adenauerallee 900','Stuttgart',
    NULL,'70563','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10313,'QUICK',2,'1996-9-24','1996-10-22','1996-10-4',2,1.96,
    'QUICK-Stop','Taucherstraße 10','Cunewalde',
    NULL,'01307','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10314,'RATTC',1,'1996-9-25','1996-10-23','1996-10-4',2,74.16,
    'Rattlesnake Canyon Grocery','2817 Milton Dr.','Albuquerque',
    'NM','87110','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10315,'ISLAT',4,'1996-9-26','1996-10-24','1996-10-3',2,41.76,
    'Island Trading','Garden House Crowther Way','Cowes',
    'Isle of Wight','PO31 7PJ','UK');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10316,'RATTC',1,'1996-9-27','1996-10-25','1996-10-8',3,150.15,
    'Rattlesnake Canyon Grocery','2817 Milton Dr.','Albuquerque',
    'NM','87110','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10317,'LONEP',6,'1996-9-30','1996-10-28','1996-10-10',1,12.69,
    'Lonesome Pine Restaurant','89 Chiaroscuro Rd.','Portland',
    'OR','97219','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10318,'ISLAT',8,'1996-10-1','1996-10-29','1996-10-4',2,4.73,
    'Island Trading','Garden House Crowther Way','Cowes',
    'Isle of Wight','PO31 7PJ','UK');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10319,'TORTU',7,'1996-10-2','1996-10-30','1996-10-11',3,64.50,
    'Tortuga Restaurante','Avda. Azteca 123','México D.F.',
    NULL,'05033','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10320,'WARTH',5,'1996-10-3','1996-10-17','1996-10-18',3,34.57,
    'Wartian Herkku','Torikatu 38','Oulu',
    NULL,'90110','Finland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10321,'ISLAT',3,'1996-10-3','1996-10-31','1996-10-11',2,3.43,
    'Island Trading','Garden House Crowther Way','Cowes',
    'Isle of Wight','PO31 7PJ','UK');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10322,'PERIC',7,'1996-10-4','1996-11-1','1996-10-23',3,0.40,
    'Pericles Comidas clásicas','Calle Dr. Jorge Cash 321','México D.F.',
    NULL,'05033','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10323,'KOENE',4,'1996-10-7','1996-11-4','1996-10-14',1,4.88,
    'Königlich Essen','Maubelstr. 90','Brandenburg',
    NULL,'14776','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10324,'SAVEA',9,'1996-10-8','1996-11-5','1996-10-10',1,214.27,
    'Save-a-lot Markets','187 Suffolk Ln.','Boise',
    'ID','83720','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10325,'KOENE',1,'1996-10-9','1996-10-23','1996-10-14',3,64.86,
    'Königlich Essen','Maubelstr. 90','Brandenburg',
    NULL,'14776','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10326,'BOLID',4,'1996-10-10','1996-11-7','1996-10-14',2,77.92,
    'Bólido Comidas preparadas','C/ Araquil, 67','Madrid',
    NULL,'28023','Spain');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10327,'FOLKO',2,'1996-10-11','1996-11-8','1996-10-14',1,63.36,
    'Folk och fä HB','Åkergatan 24','Bräcke',
    NULL,'S-844 67','Sweden');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10328,'FURIB',4,'1996-10-14','1996-11-11','1996-10-17',3,87.03,
    'Furia Bacalhau e Frutos do Mar','Jardim das rosas n. 32','Lisboa',
    NULL,'1675','Portugal');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10329,'SPLIR',4,'1996-10-15','1996-11-26','1996-10-23',2,191.67,
    'Split Rail Beer & Ale','P.O. Box 555','Lander',
    'WY','82520','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10330,'LILAS',3,'1996-10-16','1996-11-13','1996-10-28',1,12.75,
    'LILA-Supermercado','Carrera 52 con Ave. Bolívar #65-98 Llano Largo','Barquisimeto',
    'Lara','3508','Venezuela');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10331,'BONAP',9,'1996-10-16','1996-11-27','1996-10-21',1,10.19,
    'Bon app''','12, rue des Bouchers','Marseille',
    NULL,'13008','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10332,'MEREP',3,'1996-10-17','1996-11-28','1996-10-21',2,52.84,
    'Mère Paillarde','43 rue St. Laurent','Montréal',
    'Québec','H1J 1C3','Canada');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10333,'WARTH',5,'1996-10-18','1996-11-15','1996-10-25',3,0.59,
    'Wartian Herkku','Torikatu 38','Oulu',
    NULL,'90110','Finland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10334,'VICTE',8,'1996-10-21','1996-11-18','1996-10-28',2,8.56,
    'Victuailles en stock','2, rue du Commerce','Lyon',
    NULL,'69004','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10335,'HUNGO',7,'1996-10-22','1996-11-19','1996-10-24',2,42.11,
    'Hungry Owl All-Night Grocers','8 Johnstown Road','Cork',
    'Co. Cork',NULL,'Ireland');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10336,'PRINI',7,'1996-10-23','1996-11-20','1996-10-25',2,15.51,
    'Princesa Isabel Vinhos','Estrada da saúde n. 58','Lisboa',
    NULL,'1756','Portugal');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10337,'FRANK',4,'1996-10-24','1996-11-21','1996-10-29',3,108.26,
    'Frankenversand','Berliner Platz 43','München',
    NULL,'80805','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10338,'OLDWO',4,'1996-10-25','1996-11-22','1996-10-29',3,84.21,
    'Old World Delicatessen','2743 Bering St.','Anchorage',
    'AK','99508','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10339,'MEREP',2,'1996-10-28','1996-11-25','1996-11-4',2,15.66,
    'Mère Paillarde','43 rue St. Laurent','Montréal',
    'Québec','H1J 1C3','Canada');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10340,'BONAP',1,'1996-10-29','1996-11-26','1996-11-8',3,166.31,
    'Bon app''','12, rue des Bouchers','Marseille',
    NULL,'13008','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10341,'SIMOB',7,'1996-10-29','1996-11-26','1996-11-5',3,26.78,
    'Simons bistro','Vinbæltet 34','Kobenhavn',
    NULL,'1734','Denmark');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10342,'FRANK',4,'1996-10-30','1996-11-13','1996-11-4',2,54.83,
    'Frankenversand','Berliner Platz 43','München',
    NULL,'80805','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10343,'LEHMS',4,'1996-10-31','1996-11-28','1996-11-6',1,110.37,
    'Lehmanns Marktstand','Magazinweg 7','Frankfurt a.M.',
    NULL,'60528','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10344,'WHITC',4,'1996-11-1','1996-11-29','1996-11-5',2,23.29,
    'White Clover Markets','1029 - 12th Ave. S.','Seattle',
    'WA','98124','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10345,'QUICK',2,'1996-11-4','1996-12-2','1996-11-11',2,249.06,
    'QUICK-Stop','Taucherstraße 10','Cunewalde',
    NULL,'01307','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10346,'RATTC',3,'1996-11-5','1996-12-17','1996-11-8',3,142.08,
    'Rattlesnake Canyon Grocery','2817 Milton Dr.','Albuquerque',
    'NM','87110','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10347,'FAMIA',4,'1996-11-6','1996-12-4','1996-11-8',3,3.10,
    'Familia Arquibaldo','Rua Orós, 92','Sao Paulo',
    'SP','05442-030','Brazil');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10348,'WANDK',4,'1996-11-7','1996-12-5','1996-11-15',2,0.78,
    'Die Wandernde Kuh','Adenauerallee 900','Stuttgart',
    NULL,'70563','Germany');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10349,'SPLIR',7,'1996-11-8','1996-12-6','1996-11-15',1,8.63,
    'Split Rail Beer & Ale','P.O. Box 555','Lander',
    'WY','82520','USA');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10350,'LAMAI',6,'1996-11-11','1996-12-9','1996-12-3',2,64.19,
    'La maison d''Asie','1 rue Alsace-Lorraine','Toulouse',
    NULL,'31000','France');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10351,'ERNSH',1,'1996-11-11','1996-12-9','1996-11-20',1,162.33,
    'Ernst Handel','Kirchgasse 6','Graz',
    NULL,'8010','Austria');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10352,'FURIB',3,'1996-11-12','1996-11-26','1996-11-18',3,1.30,
    'Furia Bacalhau e Frutos do Mar','Jardim das rosas n. 32','Lisboa',
    NULL,'1675','Portugal');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10353,'PICCO',7,'1996-11-13','1996-12-11','1996-11-25',3,360.63,
    'Piccolo und mehr','Geislweg 14','Salzburg',
    NULL,'5020','Austria');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10354,'PERIC',8,'1996-11-14','1996-12-12','1996-11-20',3,53.80,
    'Pericles Comidas clásicas','Calle Dr. Jorge Cash 321','México D.F.',
    NULL,'05033','Mexico');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10355,'AROUT',6,'1996-11-15','1996-12-13','1996-11-20',1,41.95,
    'Around the Horn','Brook Farm Stratford St. Mary','Colchester',
    'Essex','CO7 6JX','UK');
INSERT INTO "Orders" ("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate",
    "ShippedDate","ShipVia","Freight","ShipName","ShipAddress",
    "ShipCity","ShipRegion","ShipPostalCode","ShipCountry")
VALUES (10356,'WANDK',6,'1996-11-18','1996-12-16','1996-11-27',2,36.71,
    'Die Wandernde Kuh','Adenauerallee 900','Stuttgart',
    NULL,'70563','Germany');

The following query

SELECT o."OrderID", o."OrderDate"
    FROM "Orders" AS o
    WHERE o."CustomerID" IS NOT NULL AND o."CustomerID" LIKE 'F%';

returns

  OrderID |      OrderDate
----------+----------------------
    10264 | 1996-07-24 00:00:00
    10267 | 1996-07-29 00:00:00
    10327 | 1996-10-11 00:00:00
    10328 | 1996-10-14 00:00:00
    10337 | 1996-10-24 00:00:00
    10342 | 1996-10-30 00:00:00
    10347 | 1996-11-06 00:00:00
...

while a similar query with LIMIT

SELECT o."OrderID", o."OrderDate"
    FROM "Orders" AS o
    WHERE o."CustomerID" IS NOT NULL AND o."CustomerID" LIKE 'F%'
    LIMIT 1;

returns

  OrderID |      OrderDate
----------+----------------------
    10347 | 1996-11-06 00:00:00
(1 row)

The first row is different

Additional context What was the impact?

This affects efcore.pg tests

Jira issue: CRDB-31568

blathers-crl[bot] commented 1 year ago

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I have CC'd a few people who may be able to assist you:

If we have not gotten back to your issue within a few business days, you can try the following:

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

DrewKimball commented 1 year ago

Hi @giangpham712, thanks for the report. A different first row is returned because the queries have no ordering specified. Since the query with a LIMIT has no ordering, CRDB is free to return any single row that satisfies the WHERE clause. If you add the same ordering to your queries, the first row should be the same as you expect:

SELECT o."OrderID", o."OrderDate"
    FROM "Orders" AS o
    WHERE o."CustomerID" IS NOT NULL AND o."CustomerID" LIKE 'F%'
    ORDER BY o."OrderID";
SELECT o."OrderID", o."OrderDate"
    FROM "Orders" AS o
    WHERE o."CustomerID" IS NOT NULL AND o."CustomerID" LIKE 'F%'
    ORDER BY o."OrderID"
    LIMIT 1;

As an additional detail, the ordering needs to be unique on the query output columns; otherwise, the ordering of rows with duplicate values in the ordering columns will be unpredictable.

yuzefovich commented 1 year ago

I agree with everything Drew said, so closing as expected behavior.