Rcontens |
varchar |
30 |
不允许 |
|
正文,必须大于6个字符 |
Rtime |
datetime |
8 |
允许 |
当天 |
回贴时间 |
RclickCount |
int |
4 |
允许 |
|
点击数 |
跟贴表的结构
在查询分析器里创建这四张表
创建bbsUsers表
create table bbsUsers
(
UID int not null identity(1,1),
Uname varchar(15) not null,
Upassword varchar(10) not null,
Ubirthday datetime not null,
Uemail varchar(20),
Usex bit not null,
Uclass int,
Uremark varchar(20),
UregDate datetime not null,
Ustate int,
Upoint int,
);
创建bbsSection表
create table bbsSection
(
SID int not null identity(1,1),
Sname varchar(32) not null,
SmasterID int not null,
Sprofile varchar(20),
SclickCount int,
StopicCount int,
);
创建bbsTopic表
create table bbsTopic
(
TID int not null identity(1,1),
TsID int not null,
TuID int not null,
TreplyCount int ,
Tface int ,
Ttopic varchar(20) not null,
Tcontents varchar(30) not null,
Ttime datetime,
TclickCount int ,
Tstate int not null,
TlastReply datetime
);
创建bbsReply表
create table bbsReply
(
RID int not null identity(1,1),
RtID int not null,
RsID int not null,
RuID int not null,
Rface int,
Rcontents varchar(30) not null,
Rtime datetime,
RclickCount int
);
根据结构表中的说明添加约束
为bbsUsers表添加约束条件
alter table bbsUsers add constraint PK_UID primary key(UID)
alter table bbsUsers add constraint DF_Upssword default (888888) for Upassword
alter table bbsUsers add constraint CK_Upassword check(Len(Upassword)>=6)
alter table bbsUsers add constraint CK_Uemail check(Uemail like '%@%')
alter table bbsUsers add constraint DF_Usex default(1) for Usex
alter table
alter table bbsUsers add constraint DF_Ustate default(0) for Ustate
alter table bbsUsers add constraint DF_Upoint default(20) for Upoint
为bbsSection表添加约束条件
alter table bbsSection add constraint PK_SID primary key(SID)
alter table bbsSection add constraint DF_SclickCount default(0) for SclickCount
上一页 [1] [2] [3] [4] [5] [6] 下一页