Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Fields Convention!! Pls Help

Status
Not open for further replies.

Fori

Programmer
Jun 18, 2003
84
MT
Hi All

I was wondering if u can help...i don't even know if i posting this question in the right forum but here it goes!

What is the convention when writing fields in a database!

Would it be something like 'ID ' or more like customer_ID?

Any help would be valuable!!

Tahnks
Nick
 
I would suggest using something like this:

Table would be called Employee_T

Fields would be called Employee_lastname
Employee_firstname
or
Emp_lastname
Emp_firstname

I try to keep mine as descriptive as possible.

 
I take it you do not have a data administator at your work place (no not a database administrator).

It really does not matter as long as you follow the table/field/object naming conventions for the DBMS that you are using and that you are consistant. So if you wanted to do as you suggested it seems ok to me just as long as you are consistent.

Good Luck

 
I try to limit the use of the underscore character. It can cause problems in SQL statements and should always be qualified with square brakets (
Code:
[field_Name]
for example).

I don't bother with table names because within an SQL statement that uses multiple tables the fields are identified with the table anyway (
Code:
table1.fieldname
for example).

I like to keep the field names as descriptive as possible and capitalize the first letter of each new word in the field name (
Code:
FieldName
).

The only other thing I do is to identify foreign keys in my table by using the table and field name of the primary key as the field name. For example I have a table
Code:
Customer
with a primary key field
Code:
ID
. A second table
Code:
Orders
has a foreign key to identify the customer. This foreign key field would be named
Code:
Customer_ID
. This tells me that it is related to the
Code:
ID
field in the
Code:
Customer
table. That is my only use of the underscore character as well.

Oterwise use a system that present the information you need to know quickly and easily.

Take Care,

zemp

"Show me someone with both feet on the ground and I will show you someone who can't put their pants on."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top