说说表(saysay):
id:主键、无意义
owner:说说的主人
sendtime:发布时间
content:说说内容
-- -- 创建说说表
-- create table saysay(
-- id int unsigned auto_increment primary key,
-- owner varchar(20) not null,
-- sendtime datetime,
-- content text
-- );
-- insert into saysay (owner,sendtime,content) values ('张三','2016-03-15 15:05:10','今天天气有点凉');
-- insert into saysay (owner,sendtime,content) values ('王梅','2016-03-15 15:10:10','今天天气真凉');
评论表(comments)
id:主键、无意义(id 为0 代表一级评论)
owner:该评论的发出者
toname: 该评论是回复哪个人的
sendtime:评论的时间
content:评论的内容
ssid:是哪条说说的下面的评论
pid:一级评论的id
-- -- 创建评论表
-- create table comments (
-- id int unsigned auto_increment primary key,
-- owner varchar(20) not null,
-- toname varchar(20) not null,
-- sendtime datetime not null,
-- content text not null,
-- ssid int unsigned not null,
-- pid int,
-- foreign key (ssid) references saysay(id),
-- foreign key (pid) references comments(id),
-- foreign key (toname) references comments(owner)
-- );
id:主键、无意义
owner:说说的主人
sendtime:发布时间
content:说说内容
-- -- 创建说说表
-- create table saysay(
-- id int unsigned auto_increment primary key,
-- owner varchar(20) not null,
-- sendtime datetime,
-- content text
-- );
-- insert into saysay (owner,sendtime,content) values ('张三','2016-03-15 15:05:10','今天天气有点凉');
-- insert into saysay (owner,sendtime,content) values ('王梅','2016-03-15 15:10:10','今天天气真凉');
评论表(comments)
id:主键、无意义(id 为0 代表一级评论)
owner:该评论的发出者
toname: 该评论是回复哪个人的
sendtime:评论的时间
content:评论的内容
ssid:是哪条说说的下面的评论
pid:一级评论的id
-- -- 创建评论表
-- create table comments (
-- id int unsigned auto_increment primary key,
-- owner varchar(20) not null,
-- toname varchar(20) not null,
-- sendtime datetime not null,
-- content text not null,
-- ssid int unsigned not null,
-- pid int,
-- foreign key (ssid) references saysay(id),
-- foreign key (pid) references comments(id),
-- foreign key (toname) references comments(owner)
-- );