Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
471 views
in Technique[技术] by (71.8m points)

database - 数据库,表和列的命名约定? [关闭](Database, Table and Column Naming Conventions? [closed])

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:

(我经常问自己以下问题:)

  1. Should table names be plural?

    (表名应该是复数吗?)

  2. Should column names be singular?

    (列名应为单数吗?)

  3. Should I prefix tables or columns?

    (我应该为表格或列添加前缀吗?)

  4. Should I use any case in naming items?

    (我在命名项目时应该使用大小写吗?)

Are there any recommended guidelines out there for naming items in a database?

(有没有建议的准则来命名数据库中的项目?)

  ask by GateKiller translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I recommend checking out Microsoft's SQL Server sample databases: https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks

(我建议检查Microsoft的SQL Server示例数据库: https : //github.com/Microsoft/sql-server-samples/releases/tag/adventureworks)

The AdventureWorks sample uses a very clear and consistent naming convention that uses schema names for the organization of database objects.

(AdventureWorks示例使用非常清晰和一致的命名约定,该约定使用模式名称来组织数据库对象。)

  1. Singular names for tables

    (表的单数名称)

  2. Singular names for columns

    (列的单数名称)

  3. Schema name for tables prefix (Eg: SchemeName.TableName)

    (表前缀的架构名称(例如:SchemeName.TableName))

  4. Pascal casing (aka upper camel case)

    (Pascal机壳(又名上驼壳))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...