-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.sql
90 lines (38 loc) · 995 Bytes
/
database.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
CREATE TABLE `users` (
`id` int NOT NULL,
`email` varchar(255) NULL,
`password` varchar(255) NULL,
`role` varchar(255) NULL,
`status` varchar(255) NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `bills` (
`id` int NOT NULL,
`date` date NULL,
`time` time NULL,
`products` varchar(255) NULL,
`total` float(255,0) NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `products` (
`id` int NOT NULL,
`name` varchar(255) NULL,
`date` date NULL,
`price` float(10,2) NULL,
`stock` int(255) NULL,
`description` varchar(255) NULL,
`category` int NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `reports` (
`id` int NOT NULL,
`products` varchar(255) NULL,
`description` varchar(255) NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `categories` (
`id` int NOT NULL,
`name` varchar(255) NULL,
PRIMARY KEY (`id`)
);
ALTER TABLE `products` ADD CONSTRAINT `relation_prodcut_category` FOREIGN KEY (`category`) REFERENCES `categories` (`id`);