-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBookManager.sql
More file actions
82 lines (74 loc) · 1.91 KB
/
BookManager.sql
File metadata and controls
82 lines (74 loc) · 1.91 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Create Database BookManager
Go
Use BookManager
Go
--登录信息表
Create Table Sigin
(
ID int primary key identity(1,1),
Username varchar(20) not null,
[Password] varchar(32) not null,-- 读者随机 管理员需要md5加密 测试忽略
[Identity] int not null,-- 0读者 1图书管理员 2超级管理员
)
Go
--用户信息表
Create Table [User]
(
ID int primary key identity(1,1),
[Name] varchar(20) not null,-- 姓名
Sex int not null,
Age int,
[Uid] int foreign key references Sigin(ID),
Phone varchar(11),
EntryTime datetime,
)
Go
--分类信息表
Create Table Category
(
ID int primary key identity(1,1),
[Name] varchar(20) not null,
)
Go
--图书信息表
Create Table Book
(
ID int primary key identity(1,1),
[Name] varchar(50) not null,
Img varchar(255),
[Description] text,
Category int foreign key references Category(ID),
Number int not null,
Author varchar(32),
EntryTime datetime,
)
Go
--借阅信息表
Create Table Borrow
(
ID int primary key identity(1,1),
BookID int foreign key references Book(ID),
[Use] bit not null,-- true为借 false为还
CardID int foreign key references [User](ID),
GetTime datetime,
LoseTime datetime,
)
Go
--日志信息表
Create Table [Log]
(
ID int primary key identity(1,1),
[Uid] int foreign key references [User](ID),
Bid int foreign key references Book(ID),
Info text not null,
EntryTime datetime,
)
Go
-- 插入数据
Insert Into Sigin Values('admin','123456','2')-- 超级管理员
Insert Into Sigin Values('root','123456','1')-- 图书管理员
Insert Into [User] Values('admin','0','18','1','17677007700','2020/02/02')-- 超级管理员
Insert Into [User] Values('root','0','18','2','18677337733','2020/02/02')-- 图书管理员
Insert Into Category Values('测试分类')--分类
Insert Into Book Values('书名',null,'介绍','1','5','作者','2020/11/11')-- 图书
Go