-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject.sql
More file actions
65 lines (61 loc) · 3.28 KB
/
Copy pathProject.sql
File metadata and controls
65 lines (61 loc) · 3.28 KB
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
Create database [Assignment]
go
Use [Assignment]
go
--table [Phone]
Create table [Phone](
id int identity(1,1) primary key not null,
creator nvarchar(50) not null,
name nvarchar(50) not null,
price nvarchar(100) not null,
information nvarchar(max),
img nvarchar(max) not null,
sold int not null,
quantity int not null,
show bit not null
);
--insert phone here!
--insert phone here!
--table [User]
create table [User](
name nvarchar(50) not null,
email nvarchar(200) primary key not null,
pass nvarchar(50) not null,
[address] nvarchar(1000) not null,
city nvarchar(50) not null,
country nvarchar(50) not null,
zip nvarchar(50) not null,
phone nvarchar(50) not null
);
--table [Order] (Cart)
create table [Order](
email nvarchar(200) foreign key references [User](email) not null,
pid int foreign key references Phone(id) not null,
quantity int not null
);
--table [Wishlist]
create table Wishlist(
email nvarchar(200) foreign key references [User](email) not null,
pid int foreign key references Phone(id) not null,
quantity int not null
);
create table Sold(
account nvarchar(200) not null,
[date] date not null,
pid int not null,
pname nvarchar(max) not null,
pprice nvarchar(max) not null,
quantity int not null
);
create table History(
name nvarchar(200) not null,
email nvarchar(max) not null,
[address] nvarchar(max) not null,
city nvarchar(200) not null,
country nvarchar(200) not null,
zip nvarchar(200) not null,
tel nvarchar(200) not null,
note nvarchar(max) not null,
[date] date not null,
account nvarchar(200) foreign key references [User](email) not null
);