NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL - SQL Question

John Campbell jcampbell1 at gmail.com
Wed Apr 23 10:41:49 EDT 2008


On Tue, Apr 22, 2008 at 6:09 PM, Daniel Convissor
<danielc at analysisandsolutions.com> wrote:
> Hi John:
>  [snip]
>  Don't use sub selects unless really necessary.  They kill performance.

Yeah, that's why I knew what I was doing was wrong.

>  Also also, use a consistent naming convention.  You've got plural
>  descriptions and singular product.

While that was just an example, I am a bit stuck with legacy naming
that is all over the place.  I am not aware of any good method for
fixing a schema naming problem without a huge amount of
changes/testing.  I suppose I could create a bunch of views and fix it
piecemeal, but that will likely cause a ton of headaches.

Is there a defacto standard for schema naming?  For new stuff, I have
gone with table names as plural, and first letter is upper case, and
words separated by underscores.  Field names are lower case, separated
by underscores. Field keys should have the same name across all tables
to allow for USING.   I never know what to name timestamp/date fields.

How would you name the following tables?
Users
Permissions
User_Permissions  - a many to many connector table

Thanks,
John Campbell



More information about the talk mailing list