你遵循什么SQL编码标准? [英] What SQL coding standard do you follow?
本文介绍了你遵循什么SQL编码标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有广泛使用的SQL编码标准? SQL与C / C ++类型的编程语言有点不同。
Is there any widely used SQL coding standard out there? SQL is little bit different from C/C++ type of programming languages. Really don't know how to best format it for readability.
推荐答案
不会称之为编码标准 - 更像编码风格
Wouldn't call it coding standard - more like coding style
SELECT
T1.col1,
T1.col2,
T2.col3
FROM
table1 T1
INNER JOIN ON Table2 T2 ON T1.ID = T2.ID
WHERE
T1.col1 = 'xxx'
AND T2.Col3 = 'yyy'
- 大写保留字 b
- 新行上的主要关键字
- 不能在列前使用逗号。
- 始终使用短有意义的表别名
- 前缀视图与v
- 使用sp前缀存储过程(但不使用为内置过程保留的sp_)
- 不要前缀表
- 表名称为单数
- capitalize reserved words
- main keywords on new line
- can't get used to commas before columns
- always use short meaningful table aliases
- prefix views with v
- prefix stored procs with sp (however don't use "sp_" which is reserved for built in procs)
- don't prefix tables
- table names singular
这篇关于你遵循什么SQL编码标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文