您的位置:首页 > 数据库

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

2017-05-17 17:02 543 查看
# 数据库名 :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
);


 接下来,就根据该数据库设计,编写实现该博客系统的功能!

  

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: