SQL: How to choose Table name and Column name

Say for example you have two table Customer and Supplier. Both table have surname and forename field. Now you need a query to select the name of the Customer and Supplier also.So, in order to distinguish between Customer surname, forename and Supplier surname, forename you have to name the filed in such a so that you understand it is Customer surname or it is Supplier surname.

To achieve this we can start with FOUR CAPITAL letter what will be the short name of the table and followed by the table full name. For example: We can name the Customer table as CUSTcustomer and supplier table as SUPPsupplier.

After creating table we can start the field name of the table with the chosen FOUR CAPITAL letter short name of the table followed by under score sign followed by field name. For example: surname of the Customer table can be CUST_Surname and surname of the Supplier table can be SUPP_Surname.

Now if we run a query and from the result sheet we will be able to distinguish between Customer surname and Supplier surname.

See picture bellow:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s