QQ(腾讯)-群空间-数据库设计

DatabaseName:QQ-群空间

Model:群相册、群共享、群论坛、群成员、留言板、公告。6个模块。

Type:空间-群空间、论坛



1.B,数据库设计脚本(Database Design Script)-第一版

use master
go
-- =============================================
-- DatabaseName:QQ-群空间
-- pubdate:16:50 2013-09-26
-- author:Yuanbo
-- http://qun.qzone.qq.com/
-- =============================================
IF EXISTS (SELECT * 
       FROM   master..sysdatabases 
       WHERE  name = N'qq_qun')
    DROP DATABASE qq_qun
GO


CREATE DATABASE qq_qun
GO
use qq_qun


go
-- =============================================
-- ylb:1,账户表
-- 
-- =============================================
create table account
(
account_id int identity(100000,1) primary key,    --编号【PK】
nickname varchar(20) not null,    --昵称
pwd varchar(20) not null,        --密码
[type] int,        --类型 0:QQ号;1:QQ群号
[enable] bit --状态 0:正常;1:禁用
)


-- =============================================
-- ylb: 3.1.1 相册表
-- =============================================
create table album
(
album_id int primary key identity(1,1),    --编号【PK】
album_name varchar(30) not null,        --相册名称
album_desc varchar(80),        --相册描述
pubdate datetime default(getdate()),        --创建时间
album_url varchar(100),                        --封面图片


account_qq int references account(account_id),    --相册创建者的QQ号
account_qun_id int references account(account_id),    --QQ群号
)
GO
-- =============================================
-- ylb: 3.2.1 相片表
-- =============================================
create table photo
(
photo_id int primary key identity(100,1),    --编号【PK】
photo_name varchar(30) not null,        --相片名称
--photo_desc varchar(100),                --描述
photo_url varchar(100),                --保存地址
pubdate datetime default(getdate()),        --上传时间


album_id int references Album(album_id),    --相册编号[FK]
account_qq int references account(account_id),    --相册创建者的QQ号
account_qun_id int references account(account_id),    --QQ群号
)


GO
-- =============================================
-- ylb: 3.2.2 相片评论表
-- =============================================
create table replyphoto
(
replyphoto_id int primary key identity(100,1),--编号
content varchar(200) not null,            --评论内容
pubdate datetime default(getdate()),        --评论时间
baseId int default(0),                --评论级次 0:发表;其他:回复|跟贴


photo_id int references photo(photo_id),    --照片编号[FK]
account_qq int references account(account_id),    --相册创建者的QQ号
account_qun_id int references account(account_id),    --QQ群号
)




-- =============================================
-- ylb:1,群共享
-- 
-- =============================================
create table share
(
[filename] varchar(20),    --文件名
ttl datetime,    --有效期【14天】
filesize int,        --文件大小【8.65KB】
uploaded_author varchar(20),    --上传者
pubdate datetime default(getdate()),    --上传时间
download_cnt int,    --下载次数


account_id int references account(account_id), --上传者QQ号
account_qun_id    int references account(account_id) --群编号
)
go
-- =============================================
-- ylb:1,群论坛
-- 
-- =============================================
create table bbs
(
bbs_id int primary key identity(100,1),    --编号【PK】
[subject] varchar(20),    --主题
content varchar(400),    --内容
pubdate datetime default(getdate()),        --创建时间


lock_enable bit,    --锁帖|解锁
stick_enable bit,    --0:不顶置;1:顶置
tags_enable bit,    --0:;1:精华
lightbox_enable bit, --1:高亮


account_qq int references account(account_id),    --相册创建者的QQ号
account_qun_id int references account(account_id)    --QQ群号
)
go
-- =============================================
-- ylb:1,回复主题
-- 
-- =============================================
create table replaybbs
(
replaybbs_id int primary key identity(100,1),    --编号【PK】
content varchar(400),    --内容
pubdate datetime default(getdate()),        --创建时间




bbs_id int references bbs(bbs_id),    --主题编号
account_qq int references account(account_id),    --相册创建者的QQ号
account_qun_id int references account(account_id)    --QQ群号
)
go
-- =============================================
-- ylb:1,群成员
-- 
-- =============================================
create table member
(
member_id int primary key identity(100,1),--编号
group_nikename varchar(30),    --群昵称
sex varchar(2),        --性别
phone varchar(13),    --电话
email varchar(60),    --邮箱
remark varchar(200),--备注
pubdate datetime default(getdate()),        --创建时间
alow_admin_edit_enable bit,    --允许管理员协助修改我的群名片
[role] int,    --角色:群主|管理员|成员【power】


account_id int references account(account_id), --上传者QQ号
account_qun_id    int references account(account_id)--群编号
)
go
-- =============================================
-- ylb:1,留言板
-- 
-- =============================================
create table messageboard
(
messageboard_id int primary key identity(100,1),--编号
content varchar(30),    --内容
pubdate datetime default(getdate()),       --创建时间


account_id int references account(account_id), --上传者QQ号
account_qun_id    int references account(account_id)--群编号
)
go
-- =============================================
-- ylb:1,公告
-- 
-- =============================================
create table notice
(
notice_id int primary key identity(100,1),--编号
content varchar(30),    --内容
pubdate datetime default(getdate()),       --创建时间


account_id int references account(account_id), --上传者QQ号
account_qun_id    int references account(account_id)--群编号
)
go
-- =============================================
-- ylb:1,标签【公共】
-- 
-- =============================================
create table tag
(
tag_id uniqueidentifier,    --guid
tag_name varchar(30),    --标签名称
pubdate datetime default(getdate())       --创建时间
)
go
print 'QQ 群空间数据创建成功!'


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值