ylbtech-memorandum(备忘录)-数据库设计

ylbtech-DatabaseDesgin:ylbtech-memorandum(备忘录)-数据库设计

-- =============================================
-- DatabaseName:ylbtech_memorandum
-- Desc: 备忘录
-- Model:
-- pubdate:15:50 2014-12-30
-- author:Yuanbo
-- http://*.com/
-- =============================================

1.A,数据库关系图(Database Diagram) 返回顶部

 

1.B,数据库设计脚本(Database Design Script)返回顶部

1.B.1,

use master
go
-- =============================================
-- DatabaseName:Memorandum
-- Desc: 备忘录
-- Model:
-- pubdate:15:50 2014-12-30
-- author:Yuanbo
-- http://*.com/
-- =============================================
IF EXISTS (SELECT * 
       FROM   master..sysdatabases 
       WHERE  name = N'ylbtech_memorandum')
    DROP DATABASE ylbtech_memorandum
GO

CREATE DATABASE ylbtech_memorandum
GO
use ylbtech_memorandum


GO
-- =============================================
-- ylb:1,分类
-- =============================================
create table Category
(
category_id uniqueidentifier primary key,    --编号【UI,PK】
category_name varchar(200),    --名称
grade uniqueidentifier     --级别
)
GO
-- =============================================
-- ylb:1,标签表
-- =============================================
create table Tag
(
tag_id uniqueidentifier primary key,    --编号【UI,PK】
tag_name varchar(200)    --标签
)

GO
-- =============================================
-- ylb:1,附件表
-- =============================================
create table Attachment
(
attachment_id uniqueidentifier primary key,    --编号【UI,PK】
attachment_name varchar(200),    --文件
type varchar(200),        --类型(附件连接|数据库附件|拷贝附件)
pubdate datetime default(getdate())    --添加时间
)


GO
-- =============================================
-- ylb:1,备忘录表
-- =============================================
create table Memorandum
(
memorandum_id uniqueidentifier primary key,    --编号【UI,PK】
subject varchar(200),    --主题
tag varchar(200),    --标签
target varchar(200),    --归属目标
content varchar(2000),    --内容
pubdate datetime default(getdate()),    --发布时间
category_id uniqueidentifier references Category(category_id)    --分类编号(分类表)【FK】
)

GO
-- =============================================
-- ylb:1,备忘录关系表
-- =============================================
create table MemorandumRelation
(
type varchar(200),    --类型 tag:标签;attachment:附件
memorandumRelation_id uniqueidentifier,    --编号
memorandum_id uniqueidentifier references Memorandum(memorandum_id)--备忘录编号(备忘录表)【FK】
)
View Code

1.B.2,

1.C,功能实现代码(Function Implementation Code)返回顶部
warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/ylbtech/p/4195629.html