insert_data.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. // insert_data.php
  3. require_once "bootstrap.php";
  4. $shardManager->selectShard(0);
  5. $conn->insert("Products", array(
  6. "ProductID" => 386,
  7. "SupplierID" => 1001,
  8. "ProductName" => 'Titanium Extension Bracket Left Hand',
  9. "Price" => 5.25,
  10. ));
  11. $conn->insert("Products", array(
  12. "ProductID" => 387,
  13. "SupplierID" => 1001,
  14. "ProductName" => 'Titanium Extension Bracket Right Hand',
  15. "Price" => 5.25,
  16. ));
  17. $conn->insert("Products", array(
  18. "ProductID" => 388,
  19. "SupplierID" => 1001,
  20. "ProductName" => 'Fusion Generator Module 5 kV',
  21. "Price" => 10.50,
  22. ));
  23. $conn->insert("Products", array(
  24. "ProductID" => 389,
  25. "SupplierID" => 1001,
  26. "ProductName" => 'Bypass Filter 400 MHz Low Pass',
  27. "Price" => 10.50,
  28. ));
  29. $conn->insert("Customers", array(
  30. 'CustomerID' => 10,
  31. 'CompanyName' => 'Van Nuys',
  32. 'FirstName' => 'Catherine',
  33. 'LastName' => 'Abel',
  34. ));
  35. $conn->insert("Customers", array(
  36. 'CustomerID' => 20,
  37. 'CompanyName' => 'Abercrombie',
  38. 'FirstName' => 'Kim',
  39. 'LastName' => 'Branch',
  40. ));
  41. $conn->insert("Customers", array(
  42. 'CustomerID' => 30,
  43. 'CompanyName' => 'Contoso',
  44. 'FirstName' => 'Frances',
  45. 'LastName' => 'Adams',
  46. ));
  47. $conn->insert("Customers", array(
  48. 'CustomerID' => 40,
  49. 'CompanyName' => 'A. Datum Corporation',
  50. 'FirstName' => 'Mark',
  51. 'LastName' => 'Harrington',
  52. ));
  53. $conn->insert("Customers", array(
  54. 'CustomerID' => 50,
  55. 'CompanyName' => 'Adventure Works',
  56. 'FirstName' => 'Keith',
  57. 'LastName' => 'Harris',
  58. ));
  59. $conn->insert("Customers", array(
  60. 'CustomerID' => 60,
  61. 'CompanyName' => 'Alpine Ski House',
  62. 'FirstName' => 'Wilson',
  63. 'LastName' => 'Pais',
  64. ));
  65. $conn->insert("Customers", array(
  66. 'CustomerID' => 70,
  67. 'CompanyName' => 'Baldwin Museum of Science',
  68. 'FirstName' => 'Roger',
  69. 'LastName' => 'Harui',
  70. ));
  71. $conn->insert("Customers", array(
  72. 'CustomerID' => 80,
  73. 'CompanyName' => 'Blue Yonder Airlines',
  74. 'FirstName' => 'Pilar',
  75. 'LastName' => 'Pinilla',
  76. ));
  77. $conn->insert("Customers", array(
  78. 'CustomerID' => 90,
  79. 'CompanyName' => 'City Power & Light',
  80. 'FirstName' => 'Kari',
  81. 'LastName' => 'Hensien',
  82. ));
  83. $conn->insert("Customers", array(
  84. 'CustomerID' => 100,
  85. 'CompanyName' => 'Coho Winery',
  86. 'FirstName' => 'Peter',
  87. 'LastName' => 'Brehm',
  88. ));
  89. $conn->executeUpdate("
  90. DECLARE @orderId INT
  91. DECLARE @customerId INT
  92. SET @orderId = 10
  93. SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Hensien' and FirstName = 'Kari'
  94. INSERT INTO Orders (CustomerId, OrderId, OrderDate)
  95. VALUES (@customerId, @orderId, GetDate())
  96. INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
  97. VALUES (@customerId, @orderId, 388, 4)
  98. SET @orderId = 20
  99. SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Harui' and FirstName = 'Roger'
  100. INSERT INTO Orders (CustomerId, OrderId, OrderDate)
  101. VALUES (@customerId, @orderId, GetDate())
  102. INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
  103. VALUES (@customerId, @orderId, 389, 2)
  104. SET @orderId = 30
  105. SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Brehm' and FirstName = 'Peter'
  106. INSERT INTO Orders (CustomerId, OrderId, OrderDate)
  107. VALUES (@customerId, @orderId, GetDate())
  108. INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
  109. VALUES (@customerId, @orderId, 387, 3)
  110. SET @orderId = 40
  111. SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Pais' and FirstName = 'Wilson'
  112. INSERT INTO Orders (CustomerId, OrderId, OrderDate)
  113. VALUES (@customerId, @orderId, GetDate())
  114. INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
  115. VALUES (@customerId, @orderId, 388, 1)");