Mysql Naming Convention

Gregory Hill Gregory_Hill at
Tue Apr 18 15:33:54 MDT 2006

>  > I was wondering if there is a mysql naming convention for tables
> columns ... Is there a right or wrong way to do it ?
> Simple answer: plural=wrong
> Why?  irregular plurals.  I mean, maybe you don't have an abstracted
> to find the id based on the table name, but if you ever did, you're
> hosed (addresses=addresse_id?).  Also, if you think of the table in a
> pseudo-class way, then the class name would be singular, a blueprint
> the objects (records).

Holy crap, I totally agree with my brother.  Who would've thought?

Seriously, though, this has been brought up before and everyone has
their own opinion, but I've found that singular table names and having
the primary key contain the table name (i.e. user->user_id instead of
user->id or users->user_id or users->id) is vastly more maintainable and
obvious than any other solution.

Having a simple name such as 'id' as the primary key seems a good idea
until you have to do multiple joins and keep straight which 'id' column
is which.  It requires a lot of extra aliasing that isn't necessary if
you just maintain a consistent naming convention throughout your

But, there is no rule or standard in this regard.
My $0.02.


More information about the PLUG mailing list