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?
Database names must only consist of the letters a to z (both lower and upper case allowed), the numbers 0 to 9 , and the underscore ( _ ) or dash ( - ) symbols. This also means that any non-ASCII database names are not allowed. Database names must always start with a letter.
Column names must contain only A to Z, 0 to 9, and underscore (_) characters. Column names can contain multiple underscores. The column name must not be very generic. Avoid words such as term, multiplier, description, name, code, and so on.
When naming tables, you have two options – to use the singular for the table name or to use a plural. My suggestion would be to always go with names in the singular. If you're naming entities that represent real-world facts, you should use nouns. These are tables like employee, customer, city, and country.
Each column name should be unique. If two columns from different tables serving different purposes are in the same database then use some kind of prefixes that separate the two. Step-2 : Column names must not be abstract or cryptic.
I recommend checking out Microsoft's SQL Server sample databases: 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With