频道栏目
首页 > 资讯 > 其他 > 正文

博客系统开发推送第二季----数据库设计

17-05-20        来源:[db:作者]  
收藏   我要投稿
博客系统开发推送第二季----数据库设计。

# 数据库名 :blog

六张表:博客blog,用户user,博文分类category,博文article,评论review,相册picture

# 具体创建数据库脚本

article表

create table article (
  article_id int(10) auto_increment primary key,
  category_id int not null references category(category_id),
  article_title varchar(200) not null,
  article_date date ,
  article_content text ,
  article_summary text not null,
  article_acessNum int not null default 0,
  article_reviewNum int not null default 0
)

blog表

create table blog(
blog_id INT AUTO_INCREMENT PRIMARY KEY,
blog_title varchar(50) not null,
blog_logo varchar(50) not null
);
user表
create table user(
user_id INT AUTO_INCREMENT PRIMARY KEY,
blog_id int unique references blog(blog_id),
user_name varchar(30) not null,
user_pwd varchar(20) not null,
user_sex varchar(2) not null,
user_email varchar(50) not null,
user_picture BLOB,
user_basicInfo text
);

category表
create table category(
category_id INT AUTO_INCREMENT PRIMARY KEY,
blog_id int not null references blog(blog_id),
category_title varchar(50) not null
);

review表
create table review(
review_id INT AUTO_INCREMENT PRIMARY KEY,
article_id int not null references article(article_id),
review_content text not null,
review_datetime timestamp not null,
user_id int not null references user(user_id) 
);

picture表
create table picture(
picture_id INT AUTO_INCREMENT PRIMARY KEY,
blog_id int not null references blog(blog_id),
picture_title varchar(50) not null,
picture_profile varchar(200) not null,
picture_accessNum int not null default 0
);

接下来,就根据该数据库设计,编写实现该博客系统的功能!
相关TAG标签
上一篇:Date与String的相互转化
下一篇:函数指针与回调函数
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站