-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitDB.sql
More file actions
56 lines (50 loc) · 1.01 KB
/
initDB.sql
File metadata and controls
56 lines (50 loc) · 1.01 KB
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
CREATE TABLE "inventory" (
"Product_ID" text,
"Qty" integer,
"Limited_amount" integer,
PRIMARY KEY("Product_ID")
);
CREATE TABLE orders (
order_ID int PRIMARY KEY,
Staff_ID text,
Date_stamp text,
file_path text
);
CREATE TABLE "products" (
"Product_ID" text,
"Product_Name" text,
"Product_Discription" text,
"Product_Order_amount" integer,
"Delivery" TEXT,
PRIMARY KEY("Product_ID")
);
CREATE TABLE staff (
Staff_ID text PRIMARY KEY,
staff_name text,
staff_email text,
unit_ID text
);
CREATE VIEW stock_inventory
AS
SELECT
products.Product_ID,
products.Product_Name,
products.Product_Discription,
products.Product_Order_amount,
products.Delivery,
inventory.Qty,
inventory.Limited_amount
FROM
products
INNER JOIN
inventory
ON
products.Product_ID = inventory.Product_ID;
update
inventory
SET
inv_version_id = Product_ID;
update
products
SET
prod_version_id = Product_ID