Advertisement
pgapr14

seminar data 5

Oct 17th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.04 KB | None | 0 0
  1. /*SalesOrder */
  2.  
  3. /* modify and fill sales orders */
  4.  
  5. -- remove some columns
  6. SET sql_safe_updates=0;
  7.  
  8. DELETE FROM SalesOrders;
  9. ALTER TABLE SalesOrders
  10. AUTO_INCREMENT 1;
  11.  
  12. ALTER TABLE SalesOrders
  13. DROP COLUMN LastChangeDate,
  14. DROP COLUMN OrderNumber,
  15. DROP COLUMN VehicleRegistrationNumber,
  16. DROP COLUMN shipdate,
  17. DROP COLUMN     IncludeTransportation,
  18. DROP COLUMN     DriverName,
  19. DROP COLUMN     DriverIdentificationNumber,
  20. DROP COLUMN     TotalVolume,
  21. DROP COLUMN     TransportationAmount;
  22.  
  23. SELECT * FROM SalesOrders;
  24.  
  25. -- execute once
  26.  
  27. INSERT INTO SalesOrders
  28. ( OrderDate,TotalAmount, TotalWeight, CustomerId, PriceList_PriceListId, ResponsibleID)
  29. VALUES
  30. (Now(),200,205,1,1,3),
  31. (Now(),400,200,2,1,2),
  32. (Now(),300,205,2,1,3),
  33. (Now(),500,304,2,1,11),
  34. (Now(),700,107,1,1,12),
  35. (Now(),400,204,1,1,17),
  36. (Now(),800,406,2,1,9),
  37. (Now(),550,109,1,1,13),
  38. (Now(),150,205,1,1,2),
  39. (Now(),402,205,2,1,3);
  40.  
  41. /* SalesorderLines modification*/
  42.  
  43.  
  44.  
  45. DELETE FROM SalesorderLines;
  46. ALTER TABLE SalesorderLines
  47. AUTO_INCREMENT 1;
  48.  
  49. ALTER TABLE SalesorderLines
  50. DROP COLUMN TaxPercent,
  51. DROP COLUMN DiscountAmount,
  52. DROP COLUMN PriceWithoutTax;
  53.  
  54.  
  55. SELECT * FROM SalesorderLines;
  56. SELECT * FROM UnitOfMeasures;
  57. SELECT * FROM Products;
  58.  
  59.  INSERT INTO SalesorderLines
  60.  (SalesOrderId,ProductId, UnitOfMeasureId, Quantity,SalesPrice, TaxAmount, Subtotal)
  61.  VALUES
  62.  (1,1,1,22,1.8,0.2, 22*3),
  63.  (1,2,1,40,1.8,0.2, 22*3),
  64.  (1,3,1,2,6.8,0.2, 2*7),
  65.  (2,1,1,22,1.8,0.2, 22*3),
  66.  (2,2,1,40,1.8,0.2, 22*3),
  67.  (2,3,1,1,6.8,0.2, 7),
  68.  (2,4,1,1,6.8,0.2, 7),
  69.  (3,1,1,22,1.8,0.2, 22*3),
  70.  (3,2,1,40,1.8,0.2, 22*3),
  71.  (3,3,1,1,6.8,0.2, 7),
  72.  (3,4,1,1,6.8,0.2, 7),
  73.  (4,1,1,22,1.8,0.2, 22*3),
  74.  (4,2,1,40,1.8,0.2, 22*3),
  75.  (4,3,1,2,6.8,0.2, 2*7),
  76.  (5,1,1,22,1.8,0.2, 22*3),
  77.  (5,2,1,40,1.8,0.2, 22*3),
  78.  (5,3,1,2,6.8,0.2, 2*7),
  79.  (6,1,1,22,1.8,0.2, 22*3),
  80.  (6,2,1,40,1.8,0.2, 22*3),
  81.  (6,3,1,2,6.8,0.2, 2*7),
  82.  (7,1,1,22,1.8,0.2, 22*3),
  83.  (7,2,1,40,1.8,0.2, 22*3),
  84.  (7,3,1,2,6.8,0.2, 2*7),
  85.  (8,1,1,22,1.8,0.2, 22*3),
  86.  (8,2,1,40,1.8,0.2, 22*3),
  87.  (8,3,1,10,6.8,0.2, 10*7);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement