I need to create database for SQL Server, what kind of naming convention I should use?
1) Table names could be : customer, Customer, CUSTOMER
2) Field names could be : customer_id, CustomerId, CustomerID, CUSTOMER_ID, customerid, CUSTOMERID and so on…
Is there any official suggestion for naming conventions or what is most common way to name tables and fields?
There are a lot of different and differing standards – pick the one that makes most sense to you and then stick to it – that’s the most important part. Have a standard and live up to it!
Things to consider are:
Customer) vs. plural (Customers)Customervs.tblCustomervs.T_Customervs. something else entirely)naming of columns – any defaults? E.g.
IDfor the primary key? OrCustomerID?naming of other database objects like views (
CustomerViewvs.vwCustomers), stored procedures (just be sure to avoidsp_as your prefix! Reserved by Microsoft), user-defined functions (GetDatavs.fnGetDatavs.func_GetData)There’s no “official best practice” on this – different standards suggestions have their merits, but you’re basically free in choosing what you want to use for your own company / your own doings.
Just google or bing for “sql server naming conventions” and you’ll find a gazillion of different standards. Pick the one you’re most comfortable with, or come up with your own.