user622378
user622378

Reputation: 2346

naming conventions of Field Name

What is your naming conventions of Field Name..

Which is popular way?

Example:

firstname
First_Name
first_name
firstName
FirstName



category_id
categoryID
CategoryID
categoryId

Upvotes: 1

Views: 175

Answers (3)

judda
judda

Reputation: 3972

This is all a matter of preference. I personally am more used to camelcase (FirstName) or for id fields (CategoryID) to break away from it. But that is just because all of the databases I have been in lately are set up using it. So it is more whatever feels natural to you.

As for ids and foreign keys, I make the id in both tables the same (i.e. Category table would have CategoryID as the key and anything referencing it would also have CategoryID for the field name).

Upvotes: 1

CristiC
CristiC

Reputation: 22708

Usually, it should be all lowercase chars and using _ between letters.

But for example if you have a table Category and a primary key, in my opinion this should by id (not category_id). I use category_id in another table as a foreign key.

Upvotes: 0

Gaurav
Gaurav

Reputation: 28775

I would recommend first_name and category_id due to readability and easily understandable.

Upvotes: 5

Related Questions