-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sql
72 lines (66 loc) · 1.65 KB
/
start.sql
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
CREATE DATABASE tuckshop;
USE tuckshop;
CREATE TABLE transactions (
id smallint unsigned not null auto_increment,
user_id smallint unsigned not null,
product_id smallint unsigned not null,
bal_change smallint not null,
traded_at timestamp not null DEFAULT CURRENT_TIMESTAMP,
checksum int unsigned not null,
primary key (id)
);
CREATE TABLE stock (
id smallint unsigned not null auto_increment,
product_id smallint unsigned not null,
total_cost decimal(4,1) not null,
quantity smallint unsigned not null,
stocked_at timestamp not null DEFAULT CURRENT_TIMESTAMP,
primary key (id)
);
CREATE TABLE products (
id smallint unsigned not null auto_increment,
name char(32) not null,
price smallint unsigned not null,
created_at timestamp not null DEFAULT CURRENT_TIMESTAMP,
primary key (id)
);
CREATE TABLE users (
id smallint unsigned not null auto_increment,
name char(32) not null,
created_at timestamp not null DEFAULT CURRENT_TIMESTAMP,
primary key (id)
);
INSERT INTO users (name) VALUES
('KINAGI Amrutavarsh'),
('REN Jiming'),
('CHENG Kwan'),
('MAK Ka Hei'),
('YIU Kwok Ting'),
('CHIU Ka Wa'),
('WONG Ka Yiu'),
('YIM Man Chak'),
('HO Ming Tak'),
('TSENG Mu-ruei'),
('LEUNG Pok Man'),
('QIAN Shiyi'),
('CHEUNG Tsz Yan'),
('POON Wing Sze'),
('LI Xuanyi'),
('LAM Yiu Tung'),
('IEONG Zi Liang Jason'),
('LEE Chun Hei'),
('TSE Ho Nam'),
('MAK Kin Wing'),
('CHEUNG Daniel'),
('WONG Yuk Chun');
INSERT INTO products (name, price) VALUES
('Oreo Choco',2),
('Oreo Vanilla',2),
('Ritz Lemon',2),
('Ritz Cheese',2),
('Calbee Grill a Corn',3),
('Calbee Ethnicans Pot',5),
('Lays Sour Cream',5),
('Lays BBQ',5),
('Vita Ceylon LT',3),
('Vitasoy Malted',4);