[thelist] Database Naming Conventions

Joshua Olson joshua at waetech.com
Wed Mar 15 15:05:11 CST 2006


> -----Original Message-----
> From: Canfield, Joel
> Sent: Wednesday, March 15, 2006 2:42 PM
> 
> 
> I daily work with both, and I detest, a lot, typing 'tbl_' in front of
> the name in every single query. No one here can present a reasonable
> argument for it; it was just their company's standard, and no one
> questioned it.
> 
> I used to name my ids "EmployeeID" "PhoneID", etc. Now, they're named
> "id" in their respective tables, and named with the table name in the
> foreign tables. I'm not totally sold on this method, but it's working
> for now.

Spin,

I completely agree.  My pk's are id, and FK's are [table_name]_id.  I just
find this syntax much more pleasant to work with.  

I'm so anal I even have a specific ordering for fields in tables.  I put
fk's directly after the pk, followed by non-flag (int, varchar, etc) fields,
followed by flag (bit or tinyint) fields named like "is_enabled",
"is_recurring", etc, followed lastly by date flags (date_created,
date_deleted, etc).

:-)

That being said, I only know of one compelling reason to name PK's and FK's
like "EmployeeID".  For database that support NATURAL JOIN, the join will
occur automagically if the PK and FK are named the same.

<><><><><><><><><><>
Joshua L. Olson
WAE Technologies, Inc.
http://www.waetech.com/
Phone: 706.210.0168
Fax: 413.812.4864

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/ 



More information about the thelist mailing list