logo资料库

SNS社交网站 数据库设计.doc

第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
资料共3页,全文预览结束
用户表:users 列名 user_id user_name password email age school address sex 约束 类型 INT(8) NOT NULL VARCHAR(40) NOT NULL VARCHAR(20) NOT NULL VARCHAR(128) Unique INT(8) VARCHAR(100) VARCHAR(100) CARCHAR(10) state Tinyint Birthday Date Telephone Varchar(25) Picture Varchar(128) 好友关系表:friends 列名 my_id friend_id State 类型 INT(8) INT(8) Tinyint 消息表:messages 列名 Message_id From_id To_id content Type 类型 INT(8) INT(8) INT(8) Varchar(300) Int(2) 注:当 Type==0 时是系统消息 Type==1 时好友申请消息 键 主键 描述 自增 登录的状态 用 户 头 像 的 路 径 CHECK OPTION 男 女 Check option Tinyint(1) Tinyint(0) 约束 NOT NULL Not null Check option Tinyint(0) Tinyint(1) 约束 NOT NULL Not null Not null Check option In(0,1,2) 键 主 键 / 外 键 (users) 外键 描述 参照 users 表 参照 users 表 0:接听 1:朋友 键 主键 外键 外键 描述 自增 参照 users 表 参照 users 表 留言的内容 消息类别
Type==2 时是留言板消息 活动表:activitys 列名 Activity_id owner_id Create_date End_date Address Max_num State Topic Content Current_num 约束 Not null Not null Not null Not null 类型 Int(8) Int(8) Timestamp Timestamp Varchar(128) Not null Int(8) Not null Varchar(8) Varchar(128) Not null Varchar(512) Int(8) Not null 用户---活动关系表:joins 列名 Activity_id Joiner_id Jion_time 类型 Int(8) Int(8) timestamp 动态表:news 列名 New_id Owner_id Create_date Content_text Picture Video Comment_num Share_num Type 类型 Int(8) Int(8) timestamp Varchar(512) Varchar(128) Varchar(128) Int(8) Int(8) Int(2) 约束 Not null Not null Not null 约束 Not null Not null Not null Not null Not null Check option In(0,1,2) 键 主键 外键 描述 自增 发起者 创建时间 结束时间 活动地点 最大人数 当前活动状态 活动主题 活动描述 当前参与人数 键 主键/外键 外键 描述 参照 activitys 参照 users 表 加入时间 键 主键 外键 描述 自增 发布者的 id 发布时间 发布的文字内容 图片的 url 视频的 url 评论的人数 分享人数 0:日志 1:图片 2:视频
评论表:comments 列名 Commnet_id New_id Content Commenter_id Create_date 约束 ,类型 Int(8) Int(8) Varchar(521) Not null Int(8) timestamp 非空 非空 非空 非空 键 主键 外键 外键 描述 自增 参照 news 表 评论的内容 参照 users 表 创建时间 注:把对评论的回复当做一条评论,commnet.commenter_id==news.owner_id 时就表示是回复,否则为浏览者的评论。 敏感词表:words 列名 Word_id Word Replace 类型 Int(8) Varchar(20) Varchar(20) 约束 Not null Not null Not null 键 主键 Not null Not null 描述 自增 敏感词 替代词
分享到:
收藏