CREATE TABLE [Sales]( [Sale ] [bigint] NOT NULL, [City ] [int] NOT NULL, [Customer ] [int] NOT NULL, [Bill To Customer ] [int] NOT NULL, [Stock Item ] [int] NOT NULL, [Invoice Date ] [date] NOT NULL, [Delivery Date ] [date] NULL, [Salesperson ] [int] NOT NULL, [WWI Invoice ID] [int] NOT NULL, [Description] [nvarchar](100) NOT NULL, [Package] [nvarchar](50) NOT NULL, [Quantity] [int] NOT NULL, [Unit Price] [decimal](18, 2) NOT NULL, [Tax Rate] [decimal](18, 3) NOT NULL, [Total Excluding Tax] [decimal](18, 2) NOT NULL, [Tax Amount] [decimal](18, 2) NOT NULL, [Profit] [decimal](18, 2) NOT NULL, [Total Including Tax] [decimal](18, 2) NOT NULL, [Total Dry Items] [int] NOT NULL, [Total Chiller Items] [int] NOT NULL, [Lineage ] [int] NOT NULL ); --insert data INSERT INTO Sales ([Sale] , [City] , [Customer] , [Bill To Customer] , [Stock Item] , [Invoice Date] , [Delivery Date] , [Salesperson] , [WWI Invoice ID], [Description], [Package], [Quantity], [Unit Price], [Tax Rate], [Total Excluding Tax], [Tax Amount], [Profit], [Total Including Tax], [Total Dry Items], [Total Chiller Items], [Lineage] ) VALUES (1, 69644, 0, 0, 153, '2013-01-01', '2013-01-02', 15, 1, 'Ride on toy sedan car (Black) 1/12 scale', 'Each', 10, 230.0, 15, 2300.0, 345.0, 850.0, 2645.0, 10, 0, 11), (2, 47692, 0, 0, 170, '2013-01-01', '2013-01-02', 6, 2, 'Developer joke mug - old C developers never die (White)', 'Each', 9, 13.0, 15, 117.0, 17.55, 76.5, 134.55, 9, 0, 11), (3, 47692, 0, 0, 210, '2013-01-01', '2013-01-02', 6, 2, 'USB food flash drive - chocolate bar', 'Each', 9, 32.0, 15, 288.0, 43.2, 180.0, 331.2, 9, 0, 11), (4, 68504, 105, 1, 106, '2013-01-01', '2013-01-02', 4, 3, 'Superhero action jacket (Blue) XXL', 'Each', 3, 30.0, 15, 90.0, 13.5, 24.0, 103.5, 3, 0, 11), (5, 70644, 57, 1, 14, '2013-01-01', '2013-01-02', 19, 4, 'Permanent marker black 5mm nib (Black) 5mm', 'Each', 96, 2.7, 15, 259.2, 38.88, 96.0, 298.08, 96, 0, 11), (6, 70644, 57, 1, 90, '2013-01-01', '2013-01-02', 19, 4, 'Furry gorilla with big eyes slippers (Black) S', 'Each', 5, 32.0, 15, 160.0, 24.0, 120.0, 184.0, 5, 0, 11), (7, 70644, 57, 1, 170, '2013-01-01', '2013-01-02', 19, 4, 'Developer joke mug - old C developers never die (White)', 'Each', 2, 13.0, 15, 26.0, 3.9, 17.0, 29.9, 2, 0, 11), (8, 56153, 0, 0, 92, '2013-01-01', '2013-01-02', 11, 5, 'Plush shark slippers (Gray) L', 'Each', 4, 32.0, 15, 128.0, 19.2, 96.0, 147.2, 4, 0, 11), (9, 56153, 0, 0, 99, '2013-01-01', '2013-01-02', 11, 5, 'Dinosaur battery-powered slippers (Green) XL', 'Each', 3, 32.0, 15, 96.0, 14.4, 70.5, 110.4, 3, 0, 11), (10, 56153, 0, 0, 65, '2013-01-01', '2013-01-02', 11, 5, 'Large sized bubblewrap roll 50m', 'Each', 20, 24.0, 15, 480.0, 72.0, 220.0, 552.0, 20, 0, 11), (11, 50969, 0, 0, 70, '2013-01-01', '2013-01-02', 8, 6, 'Pack of 12 action figures (variety)', 'Packet', 4, 16.0, 15, 64.0, 9.6, 42.0, 73.6, 4, 0, 11), (12, 50969, 0, 0, 180, '2013-01-01', '2013-01-02', 8, 6, 'Developer joke mug - (hip, hip, array) (White)', 'Each', 6, 13.0, 15, 78.0, 11.7, 51.0, 89.7, 6, 0, 11), (13, 50969, 0, 0, 94, '2013-01-01', '2013-01-02', 8, 6, 'Plush shark slippers (Gray) S', 'Each', 9, 32.0, 15, 288.0, 43.2, 216.0, 331.2, 9, 0, 11), (14, 58731, 376, 202, 181, '2013-01-01', '2013-01-02', 6, 7, 'Developer joke mug - inheritance is the OO way to become wealthy (Black)', 'Each', 9, 13.0, 15, 117.0, 17.55, 76.5, 134.55, 9, 0, 11), (15, 58731, 376, 202, 36, '2013-01-01', '2013-01-02', 6, 7, 'Shipping carton (Brown) 305x305x305mm', 'Each', 75, 3.5, 15, 262.5, 39.38, 120.0, 301.88, 75, 0, 11), (16, 58731, 376, 202, 211, '2013-01-01', '2013-01-02', 6, 7, 'USB food flash drive - banana', 'Each', 6, 32.0, 15, 192.0, 28.8, 120.0, 220.8, 6, 0, 11), (17, 58731, 376, 202, 88, '2013-01-01', '2013-01-02', 6, 7, 'Furry gorilla with big eyes slippers (Black) L', 'Each', 1, 32.0, 15, 32.0, 4.8, 24.0, 36.8, 1, 0, 11), (18, 39209, 0, 0, 211, '2013-01-01', '2013-01-02', 4, 8, 'USB food flash drive - banana', 'Each', 4, 32.0, 15, 128.0, 19.2, 80.0, 147.2, 4, 0, 11), (19, 39209, 0, 0, 188, '2013-01-01', '2013-01-02', 4, 8, 'Developer joke mug - thats a hardware problem (White)', 'Each', 9, 13.0, 15, 117.0, 17.55, 76.5, 134.55, 9, 0, 11), (20, 39209, 0, 0, 170, '2013-01-01', '2013-01-02', 4, 8, 'Developer joke mug - old C developers never die (White)', 'Each', 1, 13.0, 15, 13.0, 1.95, 8.5, 14.95, 1, 0, 11); --select data select * from Sales order by [Customer] desc