-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
110 lines (97 loc) · 2.99 KB
/
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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
CREATE TABLE users (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
email VARCHAR(55) NOT NULL UNIQUE,
phone VARCHAR(15) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
gender varchar(55) NOT NULL,
profile_pic BLOB,
role varchar(10) DEFAULT 'user'
)auto_increment = 226571;
CREATE TABLE brand (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
logo BLOB NOT NULL
)auto_increment = 8875;
CREATE TABLE category (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL
)auto_increment = 8245;
CREATE TABLE sub_category (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL
)auto_increment = 8145;
CREATE TABLE occasion (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL
)auto_increment = 7145;
CREATE TABLE product_dimensions (
id INT PRIMARY KEY AUTO_INCREMENT,
length VARCHAR(255),
width VARCHAR(255),
height VARCHAR(255)
)auto_increment = 7245;
CREATE TABLE package_dimensions (
id INT PRIMARY KEY AUTO_INCREMENT,
length VARCHAR(255),
width VARCHAR(255),
height VARCHAR(255),
weight VARCHAR(255)
)auto_increment = 6545;
CREATE TABLE cloth (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
status BOOLEAN,
price DECIMAL(10, 2) NOT NULL,
discount DECIMAL(10, 2) NOT NULL,
gender varchar(55) NOT NULL,
material VARCHAR(255),
pattern VARCHAR(255),
sleeve_length VARCHAR(255),
neck_style VARCHAR(255),
fit VARCHAR(255),
description TEXT,
care_instructions TEXT,
country_of_origin VARCHAR(255),
brand_id INT ,
FOREIGN KEY(brand_id) references brand(id),
category_id int,
foreign key (category_id) references category(id),
sub_category_id int,
foreign key (sub_category_id) references sub_category(id),
occasion_id int,
foreign key (occasion_id) references occasion(id),
product_dimensions_id int,
foreign key (product_dimensions_id) references product_dimensions(id),
package_dimensions_id int,
foreign key (package_dimensions_id) references package_dimensions(id)
)auto_increment = 99167256184;
CREATE TABLE cloth_size (
id INT PRIMARY KEY AUTO_INCREMENT,
cloth_id INT,
size CHAR(1),
FOREIGN KEY (cloth_id) REFERENCES cloth(id)
)auto_increment = 9875;
CREATE TABLE cloth_image (
id INT PRIMARY KEY AUTO_INCREMENT,
image BLOB NOT NULL,
cloth_id INT,
FOREIGN KEY (cloth_id) REFERENCES cloth(id)
)auto_increment = 8575;
CREATE TABLE review (
id INT PRIMARY KEY AUTO_INCREMENT,
rating DECIMAL(3, 1) NOT NULL,
cloth_id INT,
user_id INT,
comments TEXT,
posted_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (cloth_id) REFERENCES cloth(id),
FOREIGN KEY (user_id) REFERENCES users(id)
)auto_increment = 55653;
CREATE TABLE review_image (
id INT PRIMARY KEY AUTO_INCREMENT,
image BLOB,
review_id INT,
FOREIGN KEY (review_id) REFERENCES review(id)
)auto_increment = 5509123;
select * from users;