【数据库课程设计】

建表

create table Admin(
ID int primary key,
Name varchar(20) not null,
Telnum varchar(11) not null,
Email varchar(20) not null
Remark text);

create table Commodity(
ID int primary key,
Name varchar(20) not null,
Number int not null,
Class varchar(20) not null,
Remark text);

create table User(
ID int primary key,
Name varchar(20) not null,
Telnum varchar(20) not null,
Email varchar(20) not null,
Address varchar(20) not null,
Class int not null,
Remark text);

create table Order(
ID int primary key,
Ordersid int not null,
Itemid int not null,
Number int not null,
Time datetime not null,
Money int not null,
Remark text);
foreign key(Ordersid) references User(ID),
foreign key(Itemid) references Commodity(ID),
Remark text);

create table ClinkM(
ID int primary key,
Commodityid int not null,
Ownerid int not null,
foreign key(Commodityid) references Commodity(ID),
foreign key(Ownerid) references User(ID),
Remark text);

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

---------------------

猜你喜欢

转载自www.cnblogs.com/hyhy904/p/11109105.html