📄 建库表.sql
字号:
use bbs
go
--用户表
if exists(select * from sysobjects where name = 'userInfo')
drop table userInfo
go
create table userInfo
(
uId int identity (1,1), --用户id【主键】
uName nvarchar(10) not null, --用户名【唯一约束】
uPassWord nvarchar(20) not null,--用户密码
uSex bit not null, --用户性别
uFace nvarchar(5) not null, --用户头像路径
uType int not null, --用户类型【默认为0普通会员】
--禁言用户:-1、普通会员:0、版主:1、管理员:2
uRegTime datetime not null --用户注册时间【默认为当前时间】
)
go
--版块表
if exists(select * from sysobjects where name ='sectionInfo' )
drop table sectionInfo
create table sectionInfo
(
sId int identity(1,1), --版块id【主键】
sName nvarchar(20) not null,--版块名
sMasterId int not null, --版主id【默认为0】
sTopicCount int not null, --帖子数量【默认为0】
sParentId int not null --父版块【默认为0】
)
go
--主帖表
if exists(select * from sysobjects where name ='topicInfo')
drop table topicInfo
create table topicInfo(
tId int identity(1,1), --主帖id【主键】
tSId int not null, --所在版块id【外键】
tUId int not null, --发帖用户id【外键】
tTopic nvarchar(20) not null, --帖子标题
tContents nvarchar(100) not null, --主帖内容
tReplyCount int not null, --回复数量【默认为0】
tClickCount int not null, --点击数量【默认为0】
tPublishTime datetime not null, --发帖时间【默认为当前时间】
tModifyTime datetime --修改时间
)
go
--跟帖表
if exists(select * from sysobjects where name = 'replyInfo')
drop table replyInfo
create table replyInfo(
rId int identity(1,1), --跟帖id【主键】
rTId int not null, --回复的主帖id【外键】
rSId int not null, --跟帖所在版块id【外键】
rUId int not null, --跟帖人id【外键】
rTopic nvarchar(20), --跟帖主题
rContents nvarchar(100) not null, --跟帖内容
rPublishTime datetime, --跟帖时间【默认为当前时间】
rModifyTime datetime --修改时间
)
go
--论坛短信表
if exists(select * from sysobjects where name = 'messageInfo')
drop table messageInfo
create table messageInfo(
mId int identity(1,1), --短信id【主键】
mSendUnameId int not null, --短信的发送者id【外键】
mReceiveUnameId int not null, --短信的接收者id【外键】
mTopic nvarchar(20) not null, --短信主题
mNote nvarchar(100) not null, --短信内容
mPostTime datetime not null, --短信发送时间【默认为当前时间】
mReadSign bit not null, --【默认为false未读】
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -