请教各位是否有数据库的开发规范

LiuRong 2000-07-20 09:34:00
请问各位大虾是否有数据库的开发规范.
我最近想写一份, 想作个参考.
...全文
307 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
xgl1999 2001-06-28
  • 打赏
  • 举报
回复
呵呵。
关注。

NIERR 2001-06-27
  • 打赏
  • 举报
回复
三个范式固然重要,但是实际中许多都不可用。如果有通用型的话,请勿必告诉我哟》……
guo 2001-06-20
  • 打赏
  • 举报
回复
我看了一半,感觉是我写的^-^,但是太强调书写形式了,没有真正与数据库相关的东西.

另,不知道CHAR2是什么类型.
数划云1 2001-06-20
  • 打赏
  • 举报
回复
我们公司的数据库开发规范有那么长,真faint
LiuRong 2000-08-25
  • 打赏
  • 举报
回复
这是我写的一份DATABASE的命名规范文档,请指教!
Database Definition Standard


1 Introduction
This standard provides a framework of database coding for SRT. Teams involved in database designing, database coding can use this framework.
2 Overview
· Character set: ASCII
3 Object name definition
· The name contains all lowercases alphabet, and some special characters, “_”
· The name length is limited in 20 characters
· All the names should start at several lowercases stand for type, than a hyphen, than the true name. For example, td_name means that it is a table and it is a dynamic table.
3.1 Table
All tables’ names should start with “t”, then followed by another lowercase stands for if the table is a static one or dynamic one.
Prefix Meaning
ts_ Static table. The table is read-only. Such as the type table.
td_ Dynamic table. The table can be modified.
tb_ Big-amount table. In the future, the table will contain huge records. e.g. products table
For example: ts_type, td_name, tb_product
3.2 View
All views’ names should start with “v”, then followed by another lowercase stands for its type.
Do we need a number stand for how many table joined construct a view (TBD)
Prefix Meaning
vs_ Static view. The view is read-only.
vd_ Dynamic view. The view can be modified. But such view should be used carefully, because it may bring some conflicts.
For example: vs_member.
3.3 Field
All fields’ names should start with “f”, and then followed by other two lowercases. The first lowercase stand for if it is a PK, unique index, or index.
First lowercase Meaning
p Primary key field. A table can only have one PK. But more than one field can build A PK.
u Unique index field. A table can have more than one unique index. And A unique index can have more than one field.
f Foreign key
c Common field

Second lowercase Meaning
c char, varchar, char2, varchar2
i any forms of integer
b boolean, bit
m money, currency
d datetime, time, date
f float
l BLOb
For example: fpc_memberid, fid_opendate
3.4 Stored procedure
All stored procedures’ names should start with “p”, followed by a lowercase stands for if it is used to query or transacts.
Prefix Meaning
pq_ Used for querying data
pt_ Used for transacting
3.5 Trigger
All triggers’ names should start with “g_”, followed by the table name, then followed by “_”, then the type of the trigger.
for example: g_name_insert
3.6 Index
All triggers’ names should start with “i_”.
3.7 Others
There are other objects in database, but such objects are not accessed by database coding, so we just let them be.
4 Script Definition
4.1 Variable
TBD
4.2 Case
Reserved words should be uppercases, and user defined name should be lowercases.
For example:
SELECT fcc_name FROM td_Members
4.3 Indentation
Indent size is 4.
4.3.1 Cut the sentence
When the sentence is too long, you can use more than one line to express it. However, the following line should be indented.
For example:
SELECT fcc_name, fpi_id FROM td_Member
WHERE fcc_name = “Ron”
4.3.2 Flow control
To describe the flow control well, we should put some indentations in the right places.
For example
IF (condition) than
INSERT INTO td_member(fcc_ame) VALUES(“Ron”)

qiuzhi 2000-07-25
  • 打赏
  • 举报
回复
None说得不错 也同意Zhuluzy的说法!

比如在很多时候考虑到实际的情况,需要人为的破坏 范式,
另外,我不觉得用拼音首字母是一个效率高的方法,一时的效率没法保证以后维护或开发过程中的高效率。我主张用尽量能用英语(全名或缩写)来定义数据库对象名。
zhuluzy 2000-07-24
  • 打赏
  • 举报
回复
我的经验是不论是什么样的数据库,单纯的考虑计算机问题不会真正的开发出一个
好的数据库产品.针对现实世界的具体实例做考量才是正途.我在这方面有沉痛的教训.
所以除一般数据库开发教程外,特别要注意三点1.将来数据库的操作人员素质2.现实问题
的变化速度3.数据库维护的简便. 有时为了应用要懂得放弃纯计算机方面的设计.
对以上观点,希望高手指正.
Michaelyfj 2000-07-22
  • 打赏
  • 举报
回复
关注...
hanjzh 2000-07-21
  • 打赏
  • 举报
回复
关注
dqj 2000-07-20
  • 打赏
  • 举报
回复
:
none 2000-07-20
  • 打赏
  • 举报
回复
让我抛一块砖:

开发组中设专门的数据库管理员,对数据库的一切变动须由申请者书面申请(哪怕是电子邮件),dba与大家讨论(须无异议方可改动,以免顾此失彼)-〉修改-〉记录在案-〉更新数据库设计文档

表的设计要满足三个范式

尽量减少冗余,但不要刻意追求零冗余

要平衡完整性(约束)与性能之间的矛盾

能在服务器端后台完成的工作(约束、触发器、存储过程),不要留给客户机端

数据库对象的名称、表中列的名称要有章可循。建议列名使用拼音的首字母(ACRONYM),表名采用模块名加流水号(例如:MRP055)
这样虽然死板但是效率高(配合文档),比英文单词和汉字的方法要好

以上乱七八糟的是我的体会,恳请高手指正
csdn2000 2000-07-20
  • 打赏
  • 举报
回复
关注
huliao 2000-07-20
  • 打赏
  • 举报
回复
关注

34,575

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧