What is Naming Convention in SQL Server? Explain how to use naming Convention in SQL Server.
home / developersection / forums / what is naming convention in sql server? explain how to use naming convention in sql server.
What is Naming Convention in SQL Server? Explain how to use naming Convention in SQL Server.
Ashutosh Kumar Verma
18-Oct-2021SQL Naming Convention:
Naming convention are used to define the name of objects in Database. Naming convention is a set of rules that specifies the name of database objects based on work of that object. If you specify the name of database objects base on naming convention then you and other can easily understand the purpose of that object.
There are some Cases in naming convention to specify the name of database objects.
1- Pascal CASE: The first letter of each concatenated word is capitalized as in ‘ CustomerDetails’.
2- Camel CASE : The first letter of the first word is lower case then all subsequent concatenated word have first letter is capital as in ‘customerDetails’.
3- Underscore CASE (C- CASE): All words are separated with underscores in either Customer_Order or customer_order.
4- Snake CASE: Words are delimited by underscore like – variable_one and variable_two.
By using of naming convention specify the name of several database objects are like as,
Table: The suitable name of the database table is defined in such a way that,
‘tbl’ is used before the table name and first letter should be capital of the table name and end with ‘s’ or ‘es’.
Views: A view is a virtual table which contains row and column just like a real table. A view is created by using SQL SELECT statement.
To specify the name of view use the prefix ‘vw’ then _ then view name and then end with ‘s’ or ‘es’ like as
User defined Stored Procedure: The naming convention for user defined Stored Procedure are as-
Each user defined stores procedure should be specified as usp_<TableName>_<ActionName>
Indexes: Indexes are used in database table to retrieve the data more quickly. It increase the speed of data retrieve. The naming convention of Indexes are as,
IX_<IndexName>_<ColumnName>
Triggers : Trigger is a database objects that are invoked automatically when SQL command is execute. There are three types of trigger are created in SQL DDL trigger, DML trigger and LOGON trigger. The naming convention of trigger are as follow,
TR_<TableName>_<ActionName>