-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccessDB.txt
327 lines (263 loc) · 17.2 KB
/
AccessDB.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
-- -----------------------------------------------------
-- Schema onlineretailappdb
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `onlineretailappdb` ;
-- -----------------------------------------------------
-- Schema onlineretailappdb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `onlineretailappdb` DEFAULT CHARACTER SET utf8 ;
USE `onlineretailappdb` ;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`Customer`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Customer` ;
CREATE TABLE IF NOT EXISTS `Customer` (
`customerID` INT NOT NULL,
`customerName` VARCHAR(45) NOT NULL,
`customerEmail` VARCHAR(45) NOT NULL,
`customerContact` VARCHAR(45) NOT NULL,
`customerAddress` VARCHAR(45) NOT NULL,
`billings` VARCHAR(45) NOT NULL,
`purchaseHistory` VARCHAR(200) NOT NULL,
PRIMARY KEY (`customerID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`RetailBranch`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `RetailBranch` ;
CREATE TABLE IF NOT EXISTS `RetailBranch` (
`branchid` INT NOT NULL,
`RetailBranchName` VARCHAR(45) NOT NULL,
`retailBranchLocation` VARCHAR(45) NOT NULL,
`retailBranchAddress` VARCHAR(45) NOT NULL,
`retalBranchEmail` VARCHAR(45) NOT NULL,
`retailBranchContact` VARCHAR(45) NOT NULL,
PRIMARY KEY (`branchid`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`RetailBranchManagers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `RetailBranchManagers` ;
CREATE TABLE IF NOT EXISTS `RetailBranchManagers` (
`retailBranchMangerID` INT NOT NULL,
`branchid` INT NOT NULL,
`retailerID` INT NOT NULL,
PRIMARY KEY (`retailBranchMangerID`, `branchid`, `retailerID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`Retailers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `Retailers` ;
CREATE TABLE IF NOT EXISTS `Retailers` (
`retailerID` INT NOT NULL,
`customerID` INT NOT NULL,
`UserName` VARCHAR(45) NOT NULL,
`passwordLogin` VARCHAR(45) NOT NULL,
`retailerRoles` VARCHAR(45) NOT NULL,
PRIMARY KEY (`retailerID`, `customerID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`cart`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `cart` ;
CREATE TABLE IF NOT EXISTS `cart` (
`cartID` INT NOT NULL,
`categoryID` INT NOT NULL,
`customerID` INT NOT NULL,
`productID` INT NOT NULL,
`quantity` INT NOT NULL,
PRIMARY KEY (`cartID`, `categoryID`, `customerID`, `productID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`category`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `category` ;
CREATE TABLE IF NOT EXISTS `category` (
`categoryID` INT NOT NULL,
`categoryName` VARCHAR(45) NOT NULL,
`orderDetailsID` INT NOT NULL,
PRIMARY KEY (`categoryID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`orderDetails`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `orderDetails` ;
CREATE TABLE IF NOT EXISTS `orderDetails` (
`orderdetailsID` INT NOT NULL,
`orderID` INT NOT NULL,
`productID` VARCHAR(45) NOT NULL,
`qty` VARCHAR(45) NOT NULL,
`retailerRoles` VARCHAR(45) NOT NULL,
PRIMARY KEY (`orderdetailsID`, `orderID`, `productID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`orders`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `orders` ;
CREATE TABLE IF NOT EXISTS `orders` (
`orderID` INT NOT NULL,
`customerID` INT NOT NULL,
`ordernumber` INT NOT NULL,
`totalprice` INT NOT NULL,
`paymentmethod` VARCHAR(45) NOT NULL,
`deliverymethod` VARCHAR(45) NOT NULL,
`orderdate` VARCHAR(45) NOT NULL,
`branchid` VARCHAR(45) NOT NULL,
`date_of_delivery` DATE NOT NULL,
`status` VARCHAR(45) NOT NULL,
`noifications` VARCHAR(45) NOT NULL,
PRIMARY KEY (`orderID`, `customerID`, `branchid`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`product`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `product` ;
CREATE TABLE IF NOT EXISTS `product` (
`productID` INT NOT NULL,
`categoryID` INT NOT NULL,
`productName` VARCHAR(40) NOT NULL,
`description` VARCHAR(50) NULL,
`productprice` INT NOT NULL,
`image` VARCHAR(45) NOT NULL,
`status` VARCHAR(45) NOT NULL,
PRIMARY KEY (`productID`, `categoryID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`productBranch`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `productbranch` ;
CREATE TABLE IF NOT EXISTS `productbranch` (
`productbranchID` INT NOT NULL,
`branchID` INT NOT NULL,
`quantity` INT NULL,
PRIMARY KEY (`productbranchID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `OnlineRetailAppDB`.`retail_application_Settings`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `retail_application_Settings` ;
CREATE TABLE IF NOT EXISTS `retail_application_Settings` (
`settingsID` INT NOT NULL,
`settingType` VARCHAR(50) NOT NULL,
`emailsetting` VARCHAR(45) NOT NULL,
`phonesetting` VARCHAR(45) NOT NULL,
`facebooksetting` VARCHAR(45) NOT NULL,
PRIMARY KEY (`settingsID`))
ENGINE = InnoDB;
--------------------------------------------------------
-- Adding Foreign Keys
--------------------------------------------------------
ALTER TABLE cart
ADD FOREIGN KEY (categoryID) REFERENCES category(categoryID);
ALTER TABLE cart
ADD FOREIGN KEY (productID) REFERENCES product(productID);
ALTER TABLE cart
ADD FOREIGN KEY (customerID) REFERENCES customer(customerID);
ALTER TABLE category
ADD FOREIGN KEY (orderDetailsID) REFERENCES orderdetails(orderDetailsID);
ALTER TABLE orderdetails
ADD FOREIGN KEY (orderID) REFERENCES orders(orderID);
ALTER TABLE orders
ADD FOREIGN KEY (customerID) REFERENCES customer(customerID);
ALTER TABLE product
ADD FOREIGN KEY (categoryID) REFERENCES category(categoryID);
ALTER TABLE productbranch
ADD FOREIGN KEY (branchID) REFERENCES retailbranch(branchID);
ALTER TABLE retailbranchmanagers
ADD FOREIGN KEY (branchID) REFERENCES retailbranch(branchID);
ALTER TABLE retailbranchmanagers
ADD FOREIGN KEY (retailerID) REFERENCES retailers(retailerID);
ALTER TABLE retailers
ADD FOREIGN KEY (customerID) REFERENCES customer(customerID);
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--Insert Statements
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------
--1. retail application setting
------------------------------------------
insert into retail_application_Settings (settingsID, settingType, emailsetting, phonesetting, facebooksetting) values (1, 'google.co.jp', 'va.gov', 'smugmug.com', 'mysql.com');
insert into retail_application_Settings (settingsID, settingType, emailsetting, phonesetting, facebooksetting) values (2, 'freewebs.com', 'google.com.hk', 'latimes.com', 'theglobeandmail.com');
insert into retail_application_Settings (settingsID, settingType, emailsetting, phonesetting, facebooksetting) values (3, 'oracle.com', 'huffingtonpost.com', 'wikimedia.org', 'wired.com');
insert into retail_application_Settings (settingsID, settingType, emailsetting, phonesetting, facebooksetting) values (4, 'marriott.com', 'opera.com', 'netvibes.com', 'admin.ch');
insert into retail_application_Settings (settingsID, settingType, emailsetting, phonesetting, facebooksetting) values (5, 'meetup.com', 'prweb.com', 'geocities.jp', 'goo.ne.jp');
-------------------------------------------
--2. productbranch
------------------------------------------
insert into productbranch (productbranchID, branchID, quantity) values (1, 10, 327);
insert into productbranch (productbranchID, branchID, quantity) values (2, 7, 43);
insert into productbranch (productbranchID, branchID, quantity) values (3, 6, 948);
insert into productbranch (productbranchID, branchID, quantity) values (4, 9, 207);
insert into productbranch (productbranchID, branchID, quantity) values (5, 8, 874);
-------------------------------------------
--3. customer
------------------------------------------
insert into Customer (customerID, customerName, customerEmail, customerContact, customerAddress, billings, purchaseHistory) values (1, 'Saxe Birkmyre', '[email protected]', '118-473-7446', '71 Shasta Parkway', '', '');
insert into Customer (customerID, customerName, customerEmail, customerContact, customerAddress, billings, purchaseHistory) values (2, 'Lynsey MacLaren', '[email protected]', '743-154-5659', '0029 Norway Maple Lane', '', '');
insert into Customer (customerID, customerName, customerEmail, customerContact, customerAddress, billings, purchaseHistory) values (3, 'Eryn Manion', '[email protected]', '579-861-3803', '85 Artisan Road', '', '');
insert into Customer (customerID, customerName, customerEmail, customerContact, customerAddress, billings, purchaseHistory) values (4, 'Rebeca Weldrake', '[email protected]', '753-213-5621', '7449 Sunfield Alley', '', '');
insert into Customer (customerID, customerName, customerEmail, customerContact, customerAddress, billings, purchaseHistory) values (5, 'Braden Blackmore', '[email protected]', '198-376-9203', '88445 Gateway Center', '', '');
-------------------------------------------
--4. orders
------------------------------------------
insert into orders (orderID, customerID, ordernumber, totalprice, paymentmethod, deliverymethod, orderdate, branchID, date_of_delivery, status, noifications) values (1, 1, 1, 396, 'jcb', 'Electric Utilities: Central', '5/24/2022', 1, '2022:10:27', 'active', '-1/2');
insert into orders (orderID, customerID, ordernumber, totalprice, paymentmethod, deliverymethod, orderdate, branchID, date_of_delivery, status, noifications) values (2, 2, 2, 273, 'diners-club-enroute', 'Air Freight/Delivery Services', '11/29/2021', 2, '2022:5:11', 'inactive', 'get');
insert into orders (orderID, customerID, ordernumber, totalprice, paymentmethod, deliverymethod, orderdate, branchID, date_of_delivery, status, noifications) values (3, 3, 3, 114, 'jcb', 'Oil & Gas Production', '6/10/2022', 3, '2022:8:16', 'active', '00˙Ɩ$-');
insert into orders (orderID, customerID, ordernumber, totalprice, paymentmethod, deliverymethod, orderdate, branchID, date_of_delivery, status, noifications) values (4, 4, 4, 422, 'visa-electron', 'Biotechnology', '11/18/2022', 4, '2022:6:29', 'Tennessee', 'shipped');
insert into orders (orderID, customerID, ordernumber, totalprice, paymentmethod, deliverymethod, orderdate, branchID, date_of_delivery, status, noifications) values (5, 5, 5, 141, 'maestro', 'n/a', '8/25/2022', 5, '2022:1:19', 'active', '-1E2');
-------------------------------------------
--5. product
------------------------------------------
insert into product (productID, categoryID, productName, description, productprice, image, status) values (1, 1, 1, 'Auto Parts:O.E.M.', 58, 'http://dummyimage.com/222x100.png', 'SMP');
insert into product (productID, categoryID, productName, description, productprice, image, status) values (2, 2, 2, 'n/a', 163, 'http://dummyimage.com/203x100.png', 'NEE^I');
insert into product (productID, categoryID, productName, description, productprice, image, status) values (3, 3, 3, 'Finance: Consumer Services', 524, 'http://dummyimage.com/237x100.png', 'ELVT');
insert into product (productID, categoryID, productName, description, productprice, image, status) values (4, 4, 4, 'Property-Casualty Insurers', 550, 'http://dummyimage.com/149x100.png', 'L');
insert into product (productID, categoryID, productName, description, productprice, image, status) values (5, 5, 5, 'Life Insurance', 565, 'http://dummyimage.com/242x100.png', 'AEK');
-------------------------------------------
--6. orderDetails
------------------------------------------
insert into orderdetails (orderdetailsID, orderID, productID, qty, retailerRoles) values (6, 6, 6, 330, 'Construction Worker');
insert into orderdetails (orderdetailsID, orderID, productID, qty, retailerRoles) values (7, 7, 7, 57, 'Construction Worker');
insert into orderdetails (orderdetailsID, orderID, productID, qty, retailerRoles) values (8, 8, 8, 791, 'Electrician');
insert into orderdetails (orderdetailsID, orderID, productID, qty, retailerRoles) values (9, 9, 9, 188, 'Engineer');
insert into orderdetails (orderdetailsID, orderID, productID, qty, retailerRoles) values (10, 10, 12, 959, 'Supervisor');
-------------------------------------------
--7. retailers
------------------------------------------
insert into retailers (retailerID, customerID, UserName, passwordLogin, retailerRoles) values (1, 1, 'Rhodie Swetmore', '7DoIrDR6L', 'Engineer');
insert into retailers (retailerID, customerID, UserName, passwordLogin, retailerRoles) values (2, 2, 'Jobie Gillow', 'siDbBoQ3', 'Construction Worker');
insert into retailers (retailerID, customerID, UserName, passwordLogin, retailerRoles) values (3, 3, 'Dominic Slatten', '0NHuKLlxffl', 'Construction Expeditor');
insert into retailers (retailerID, customerID, UserName, passwordLogin, retailerRoles) values (4, 4, 'Conrado Palk', 'AIFOYOkKO', 'Estimator');
insert into retailers (retailerID, customerID, UserName, passwordLogin, retailerRoles) values (5, 5, 'Ebeneser Phear', '5eTxeSWl', 'Supervisor');
-------------------------------------------
--8. category
------------------------------------------
insert into category (categoryID, categoryName, OrderDetailsID) values (1, 'Arabela McGurk', 1);
insert into category (categoryID, categoryName, OrderDetailsID) values (2, 'Ike Langston', 2);
insert into category (categoryID, categoryName, OrderDetailsID) values (3, 'Adriena Sander', 3);
insert into category (categoryID, categoryName, OrderDetailsID) values (4, 'Mellisa Chilles', 4);
insert into category (categoryID, categoryName, OrderDetailsID) values (5, 'Alexandre Lomen', 5);
-------------------------------------------
--9. cart
------------------------------------------
insert into cart (cartID, categoryID, customerID, productID, quantity) values (1, 1, 1, 1, 646);
insert into cart (cartID, categoryID, customerID, productID, quantity) values (2, 2, 2, 2, 847);
insert into cart (cartID, categoryID, customerID, productID, quantity) values (3, 3, 3, 3, 213);
insert into cart (cartID, categoryID, customerID, productID, quantity) values (4, 4, 4, 4, 830);
insert into cart (cartID, categoryID, customerID, productID, quantity) values (5, 5, 5, 5, 261);
-------------------------------------------
--10. retailbranch
------------------------------------------
insert into retailbranch (branchid, RetailBranchName, retailBranchLocation, retailBranchAddress, retalBranchEmail, retailBranchContact) values (1, 'Alligator, american', 'Hotel India', '676 Northland Circle', '[email protected]', '126-375-3068');
insert into retailbranch (branchid, RetailBranchName, retailBranchLocation, retailBranchAddress, retalBranchEmail, retailBranchContact) values (2, 'Gecko, bent-toed', 'Alfa X-ray Mike', '1977 Magdeline Point', '[email protected]', '982-543-6651');
insert into retailbranch (branchid, RetailBranchName, retailBranchLocation, retailBranchAddress, retalBranchEmail, retailBranchContact) values (3, 'Black curlew', 'Lima Yankee', '89889 Jana Park', '[email protected]', '942-911-1631');
insert into retailbranch (branchid, RetailBranchName, retailBranchLocation, retailBranchAddress, retalBranchEmail, retailBranchContact) values (4, 'European stork', 'Foxtrot Papa', '72151 Sage Junction', '[email protected]', '314-415-7650');
insert into retailbranch (branchid, RetailBranchName, retailBranchLocation, retailBranchAddress, retalBranchEmail, retailBranchContact) values (5, 'Beisa oryx', 'Quebec Mike', '03186 Thierer Road', '[email protected]', '906-159-9500');
-------------------------------------------
--11. retailbranchmanager
------------------------------------------
insert into retailbranchmanagers (retailBranchMangerID, branchid, retailerID) values (1, 1, 310);
insert into retailbranchmanagers (retailBranchMangerID, branchid, retailerID) values (2, 2, 495);
insert into retailbranchmanagers (retailBranchMangerID, branchid, retailerID) values (3, 3, 139);
insert into retailbranchmanagers (retailBranchMangerID, branchid, retailerID) values (4, 4, 70);
insert into retailbranchmanagers (retailBranchMangerID, branchid, retailerID) values (5, 5, 20);
----------------------------------------------