问题描述
每当我设计一个数据库时,我总是想知道是否有一种最好的方法来命名我的数据库中的项目.我经常问自己以下问题:
Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions:
- 表名应该是复数吗?
- 列名应该是单数吗?
- 我应该为表或列添加前缀吗?
- 我应该在命名项目时使用任何大小写吗?
是否有任何推荐的指南来命名数据库中的项目?
Are there any recommended guidelines out there for naming items in a database?
推荐答案
我建议查看 Microsoft 的 SQL Server 示例数据库:https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks
I recommend checking out Microsoft's SQL Server sample databases:https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks
AdventureWorks 示例使用非常清晰且一致的命名约定,该约定使用架构名称来组织数据库对象.
The AdventureWorks sample uses a very clear and consistent naming convention that uses schema names for the organization of database objects.
- 表的单数名称
- 列的单一名称
- 表前缀的模式名称(例如:SchemeName.TableName)
- Pascal 外壳(又名上驼色外壳)
这篇关于数据库、表和列命名约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!