-
Notifications
You must be signed in to change notification settings - Fork 31
/
Query.sql
51 lines (44 loc) · 942 Bytes
/
Query.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
drop table CartItem
drop table Cart
use master
go
drop database UNIFY
use master
go
create database UNIFY
go
use UNIFY
go
create table [User](
id int identity,
email varchar(50),
username varchar(50) unique not null,
[password] varchar(36) not null,
avatar varchar(50),
role_id int,
primary key(id)
)
create table Category(
cate_id int identity primary key,
cate_name nvarchar(255) not null,
)
create table Product(
id int identity primary key,
[name] nvarchar(255) not null,
price float ,
cate_id int references Category(cate_id) not null,
des varchar(2000),
image varchar(50),
)
create table Cart(
id varchar(50) primary key,
u_id int references [User](id) not null ,
buyDate date
)
create table CartItem(
id varchar(50) primary key,
quantity int,
unitPrice float,
pro_id int references Product(id) not null,
cat_id varchar(50) references Cart(id) not null
)