NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL - SQL Question

PaulCheung paulcheung at tiscali.co.uk
Wed Apr 23 14:43:07 EDT 2008


Naming conventions were once a hotly debated issue back in the day when 
mainframes ruled the universe. An old applications programming technique was 
to prefix identifier. For example the Users Table would be called 
users_table and each element in that table would be prefixed with ut (for 
users_table) ending up with a file definition that looks something like

users_table(ut_time, ut_date, ut_etc.)
permissions_table(pt_time, pt_date, pt_etc.)
user_permissions(up_time, up_date, up_etc.)

Hope this is of some use

Paul

----- Original Message ----- 
From: "John Campbell" <jcampbell1 at gmail.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Wednesday, April 23, 2008 3:41 PM
Subject: Re: [nycphp-talk] MySQL - SQL Question


> 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
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php 




More information about the talk mailing list