# data[].attributes.body
https://docs.google.com/document/d/1sJog6XJZw9pqq2788OHNqBkSZbFAJ9J9_pLA3LnLp78/edit?usp=sharing

# data[].attributes.body
create table Promotion (
Promotion_id int not null primary key,
Promotion dis decimal(2,2));

create table Item (
Item_id int not null primary key.
Item_name varchar(10),
Item_quantity int,
Item_price decimal(5,2)
Promotion_id int,
Foreign key(Promotion_id) references Promotion);

create table Customer (
Cust_id int not null primary key,
Cust_name varchar(20),
Cust_address varchar(50),
Cust_contact varchar(12));

create table Seller (
Seller_id int not null primary key,
Seller_name varchar(20),
Seller_rating int,
Item_id int,
Foreign key (item_id) references Item);

create table Cart (
Cart_id int not null primary key,
Item_id int,
Item_quantity int,
Item_price decimal (2,2),
Foreign key (Item_id) references Item,
Foreign key (Item_quantity) references Item,
Foreign key (Item_price) references Item,

create table Order (
Order_id int not null primary key,
Order_date date,
Seller_id,
Cart_id,
Cust_id int,
Item_id varchar(10),
Foreign key (Seller_id) references Seller,
Foreign key (Cart_id) references Cart,
Foreign key (Cust_id) references Customer,
Foreign key (Item_id) references Item,

# data[].attributes.body
Insert into Promotion values (
(1,0.20),
(2,0.50),
(3,0.40),
(4,0.45),
(5,0.30),
(6,0.15),
(7,0.25),
(8,0.70),
(9,0.80),
(10,0.75),
(11,0.55),
(12,0.12),
(13,0.27),
(14,0.33),
(15,0.46);

Insert into Item values
(1, 'Sweater', 100, 50.0,1),
(2, 'Microwave', 100, 150.0, null),
(3, 'Phone Case', 100, 20.0, null),
(4, 'Books', 100, 20.0, null),
(5, 'Khakis', 100, 100.0,2),
(6, 'Rose Water', 10, 25.0, null),
(7, 'Heels', 100, 79.0, 7),
(8, 'Purse', 100, 59.0, null),
(9, 'Laptop', 50, 400.0, 6),
(10, 'Dress', 40, 60.0, 6),
(11, 'Sweater', 50, 90.0, 14),
(12, 'Hairdryer', 40, 160.0, 6),
(13, 'Headphone', 40, 250.0, 6),
(14, 'Vacuum', 40, 100.0, 2),
(15, 'Keyboard', 40, 75.0, 12);

Insert into Seller values
(101,'Ben',9, 13),
(101,'Ben ,9, 5),
(102,'Ali',7, 11),
(102,'Ali',7, 1),
(103, 'Siti, 8, 6),
(104, 'Greg', 10, 4),
(105, 'Loqect', 9, 12),
(105, 'Loqect', 9, 10),
(106, 'Seri', 8, 2),
(107, 'Suria', 10, 9),
(108, 'Adam', 9, 3),
(109, 'Mike', 6, 7),
(110, 'Hannah', 10, 15),
(111, 'Emma', 8, 8),
(111, 'Emma', 8, 14));

insert values into cart
(123, 2, 2, 50.0),
(123, 3,1,20.0),
(123, 4, 1, 20.0),
(456, 4, 4, 20.0),
(456, 6, 1, 25.0),
(789, 1, 1, 50.0),
(789, 5, 2, 100.0 ),
(234, 15, 1,75.0),
(234, 8, 1, 59.0),
(234, 10,1 ,60.0),
(234, 7, 1, 79.0),
(234, 6, 1, 25.0),
(567, 3, 5, 20.0),
(567, 4, 1, 20.0),
(567,12 1, 160.0);

insert into Customer values
(1, 'Lucy', 'Jalan Mangga', '012-2123324')
(2, 'Lacey', 'Jalan Mahsuri', '013-2384838')
(3, 'Wana', 'Jalan Serambi', '014-2828302')
(4, 'Lis', 'Jalan Kasturi', '019-3829473')
(5, 'Aishah', 'Jalan Merapuh', '014-3829234')
(6, 'Sabrina', 'Jalan Sampin', '011-2839204')
(7, 'Nadya', 'Jalan Memanah', '017-8354929')
(8, 'Sofea', 'Jalan Manggis', '012-3720183')
(9, 'Aida', 'Jalan Hang Tuah', '018-38294728')
(10, 'Mirza', 'Jalan Kelapa', '017-38203829')
(11, 'Yana', 'Jalan Lekir', '012-9372943')
(12, 'Belle', 'Jalan Naga', '019-2739274')
(13, 'Amy', 'Jalan Epal', '012-4729344')
(14, 'Amir', 'Jalan Rambutan', '016-8472940')
(15, 'Luqman', 'Jalan Panglima', '011-2849302'));

insert into Order values
(10010, '2018-01-15', 102, 125, 12, 5),
(10011, '2017-03-30', 107, 132, 1, 12),
(10012, '2017-12-14', 115, 135, 13, 14),
(10013, '2016-03-01', 111, 123, 5, 3),
(10014, '2018-01-31', 113, 136, 9, 15),
(10015, '2017-09-03', 106, 124, 3, 4),
(10016, '2017-05-08', 108, 130, 15, 10),
(10017, '2016-03-20', 110, 129, 10, 9),
(10018, '2015-03-25', 104, 121, 4, 1),
(10019, '2017-09-17', 114, 128, 2, 8),
(10020, '2017-03-25', 105, 126, 7, 6),
(10021, '2017-01-09', 103, 131, 11, 11),
(10022, '2018-01-11', 109, 122, 14, 2),
(10023, '2017-11-05', 101, 134, 6, 13),
(10024, '2017-07-29', 112, 127, 8, 7));

# data[].attributes.body
CUSTOMER
name, type
Cust_id int
Cust_name varchar<20>
Cust_address varchar<50>
Cust_contact int

ORDER
Order_id int

CART
Cart_id int

PROMOTION
Promotion_offer int
Promotion_dis   decimal(2,2)

ITEM
Item_id int
Item_name varchar<10>
Item_quantity int //constraint up to
Item_price decimal(5,2)

SELLER
Seller_id int
Seller_name varchar<20>
Item_id int

RATING
Rating_item int //constrain up to 5

# data[].attributes.body
1)Business Rule(thanks wis)
2)Main entities(thanks wis)
3)Relationship(thanks wis)
4)ER Diagram
-Conceptual
-Internal
5)Entities (wana)
- list attributes
6)Normalization
- 1nf
- 2nf
-3nf
7)Data Dictionary (wana)

8)DDL(code) - aishah
DML(triggers, functions, etc)

directory:
highlight : tgh buat
cross off: dah siap

# data[].attributes.body
https://photos.app.goo.gl/1W3jntQ3gy9LWHfl1

# data[].attributes.body
https://docs.google.com/document/d/12zgtHUkqw35Z60wPV47B5GHiPMxMg45QmZ9Lhgd9_mc/edit?usp=sharing

-Attributes list(FK and PK included)

# data[].attributes.body
https://docs.google.com/document/d/1En7AvLcRoSar_aR3ZmF8B-e06lA-8iZ1Qf4z0OEfh8c/edit?usp=sharing

# data[].attributes.body
cart table
cart id
cart quantity
item id