Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.97 KB | None | 0 0
  1. CREATE TABLE Customers
  2. (
  3. CustomerID INT AUTO_INCREMENT PRIMARY KEY,
  4. FirstName VARCHAR(50),
  5. LastName VARCHAR(50),
  6. City VARCHAR(50),
  7. State CHAR(2),
  8. Zip VARCHAR(10)
  9. );
  10.  
  11. CREATE TABLE Products
  12. (
  13. ProductID TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  14. ProductName VARCHAR(20),
  15. RecommendedPrice DECIMAL(15,4),
  16. Category VARCHAR(10)
  17. );
  18.  
  19. CREATE TABLE Sales
  20. (
  21. SaleID INT AUTO_INCREMENT PRIMARY KEY,
  22. ProductID TINYINT UNSIGNED NOT NULL REFERENCES Products(ProductID),
  23. CustomerID INT NOT NULL REFERENCES Customers(CustomerID),
  24. SalePrice decimal NOT NULL,
  25. SaleDate DATETIME NOT NULL
  26. );
  27.  
  28. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('DVD',105,'LivingRoom');
  29. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('Microwave',98,'Kitchen');
  30. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('Monitor',200,'Office');
  31. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('Speakers',85,'Office');
  32. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('Refrigerator',900,'Kitchen');
  33. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('VCR',165,'LivingRoom');
  34. INSERT INTO Products(ProductName, RecommendedPrice, Category) VALUES('CoffeePot',35,'Kitchen');
  35.  
  36.  
  37. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('John','Miller','Asbury','NY','23433');
  38. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Fred','Hammill','Basham','AK','85675');
  39. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Stan','Mellish','Callahan','WY','38556');
  40. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Adrian','Caparzo','Denver','CO','12377');
  41. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Mike','Horvath','Easton','IN','47130');
  42. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Irwin','Wade','Frankfurt','KY','45902');
  43. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('George','Marshall','Gallipoli','ND','34908');
  44. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Frank','Costello','Honolulu','HI','23905');
  45. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Billy','Costigan','Immice','SC','75389');
  46. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Shelly','Sipes','Lights','AZ','35263');
  47. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Chirsty','Melton','Spade','CA','97505');
  48. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Amanda','Owens','Flask','CN','50386');
  49. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Brittany','Smits','Bourbon','KY','24207');
  50. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Kristy','Bryant','Tarp','FL','58960');
  51. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Kelly','Street','TableTop','ID','57732');
  52. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Tricia','Hill','Camera','ME','46738');
  53. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Holly','Raines','Compact','MS','35735');
  54. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Natalie','Woods','Woods','IN','87219');
  55. INSERT INTO Customers(FirstName, LastName, City, State, Zip) VALUES('Wendy','Hilton','Action','KY','47093');
  56.  
  57.  
  58. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(1,1,130,str_to_date('2/6/2005', '%m/%d/%Y'));
  59. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(2,2,97,str_to_date('1/7/2005', '%m/%d/%Y'));
  60. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,3,200,str_to_date('8/8/2005', '%m/%d/%Y'));
  61. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(4,4,80,str_to_date('4/9/2005', '%m/%d/%Y'));
  62. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(5,5,899,str_to_date('10/10/2005', '%m/%d/%Y'));
  63. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(6,6,150,str_to_date('10/11/2005', '%m/%d/%Y'));
  64. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,7,209,str_to_date('12/12/2005', '%m/%d/%Y'));
  65. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(4,8,90,str_to_date('5/13/2005', '%m/%d/%Y'));
  66. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(6,9,130,str_to_date('6/14/2005', '%m/%d/%Y'));
  67. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(2,14,85,str_to_date('6/19/2005', '%m/%d/%Y'));
  68. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,15,240,str_to_date('9/20/2005', '%m/%d/%Y'));
  69. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(1,16,99,str_to_date('7/21/2005', '%m/%d/%Y'));
  70. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(1,17,87,str_to_date('3/22/2005', '%m/%d/%Y'));
  71. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(2,18,99,str_to_date('1/23/2005', '%m/%d/%Y'));
  72. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(6,19,150,str_to_date('3/24/2005', '%m/%d/%Y'));
  73. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(5,5,900,str_to_date('3/10/2005', '%m/%d/%Y'));
  74. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(4,6,86,str_to_date('8/11/2005', '%m/%d/%Y'));
  75. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(2,7,88,str_to_date('8/12/2005', '%m/%d/%Y'));
  76. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,8,198,str_to_date('12/13/2005', '%m/%d/%Y'));
  77. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(1,9,150,str_to_date('5/14/2005', '%m/%d/%Y'));
  78. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(6,14,99,str_to_date('7/19/2005', '%m/%d/%Y'));
  79. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(6,15,104,str_to_date('9/20/2005', '%m/%d/%Y'));
  80. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,16,270,str_to_date('2/21/2005', '%m/%d/%Y'));
  81. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(4,17,90,str_to_date('7/22/2005', '%m/%d/%Y'));
  82. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(1,1,130,str_to_date('3/6/2005', '%m/%d/%Y'));
  83. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(2,2,102,str_to_date('4/7/2005', '%m/%d/%Y'));
  84. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(1,3,114,str_to_date('11/8/2005', '%m/%d/%Y'));
  85. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(5,4,1000,str_to_date('5/9/2005', '%m/%d/%Y'));
  86. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(5,5,1100,str_to_date('10/10/2005', '%m/%d/%Y'));
  87. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,6,285,str_to_date('6/11/2005', '%m/%d/%Y'));
  88. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(2,7,87,str_to_date('10/12/2005', '%m/%d/%Y'));
  89. INSERT INTO Sales(ProductID, CustomerID, SalePrice, SaleDate) VALUES(3,8,300,str_to_date('7/13/2005', '%m/%d/%Y'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement