-
Notifications
You must be signed in to change notification settings - Fork 0
/
keuangan.sql
executable file
·69 lines (63 loc) · 1.97 KB
/
keuangan.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
CREATE TABLE user (
user_id int AUTO_INCREMENT NOT NULL,
nama varchar(30),
email varchar(30) NOT NULL,
password varchar(100) NOT NULL,
kode_aktifasi varchar(50),
terdaftar DATE,
aktif BIT DEFAULT 0,
PRIMARY KEY (user_id)
);
CREATE TABLE uang (
uang_id int AUTO_INCREMENT NOT NULL,
user_id int NOT NULL,
nama varchar(30),
bulan varchar(2),
tahun year,
jumlah int,
pocket varchar(11) NOT NULL UNIQUE,
qrcode varchar(15),
PRIMARY KEY (uang_id),
FOREIGN KEY (user_id) REFERENCES user(user_id)
);
CREATE TABLE kategori (
kategori_id int AUTO_INCREMENT NOT NULL,
nama varchar(30),
icon varchar(30),
PRIMARY KEY (kategori_id)
);
CREATE TABLE pengeluaran (
pengeluaran_id int AUTO_INCREMENT NOT NULL,
uang_id int NOT NULL,
kategori_id int NOT NULL,
nama varchar(30),
jumlah int,
tanggal TIMESTAMP,
PRIMARY KEY (pengeluaran_id),
FOREIGN KEY (uang_id) REFERENCES uang(uang_id),
FOREIGN KEY (kategori_id) REFERENCES kategori(kategori_id)
);
CREATE TABLE pemasukan (
pemasukan_id int AUTO_INCREMENT NOT NULL,
uang_id int NOT NULL,
nama varchar(30),
jumlah int,
tanggal TIMESTAMP,
PRIMARY KEY (pemasukan_id),
FOREIGN KEY (uang_id) REFERENCES uang(uang_id)
);
INSERT INTO user (email, password, terdaftar, aktif) VALUES
('[email protected]', '$2y$10$D1H.ceQMP8Adh5daN/paJudzPeajtznsgiDNxSpLEagLmHvajT.8y', '2019-11-09', 1);
INSERT INTO kategori VALUES
(1, 'Food and Beverage', 'fa fa-utensils'),
(2, 'Transport', 'fa fa-car'),
(3, 'Groceries', 'fa fa-shopping-basket'),
(4, 'Shopping', 'fa fa-shopping-bag'),
(5, 'Entertainment', 'fa fa-ticket-alt'),
(6, 'Utilities', 'fa fa-briefcase'),
(7, 'Personal', 'fa fa-user-circle'),
(8, 'Education', 'fa fa-graduation-cap'),
(9, 'Gift', 'fa fa-gift'),
(10, 'Cash', 'fa fa-money-bill'),
(11, 'Health', 'fa fa-heartbeat'),
(12, 'Others', 'fa fa-question-circle');