NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL - SQL Question

SyAD at aol.com SyAD at aol.com
Thu Apr 24 08:54:35 EDT 2008


 
Just to give you another convention, I do:
 
1) tbl<object> for tables, with the singular, like tblEmployee -- not really 
necessary in SQL statements directly, but I use a class to generate SQL 
statements, so in PHP function calls I can tell what's a table more easily
2) I capitalize field names with no delimiter, except that I do all caps for 
acronyms, like EmployeeName, EmployeeID
3) For dates, for some reason I put Date at the beginning, like DateOrdered, 
DateShipped.
 
Steve
 
In a message dated 4/23/2008 9:40:56 PM Eastern Daylight Time, 
jcampbell1 at gmail.com writes:

>  I used to be in the plural camp.  But I've become fond of the singular
>  camp.  That way the table can more easily match the names of the columns.
>  This makes things easier when it comes to making automatic tools for
>  sanitizing input and reverse engineering databases.

Makes sense. I will join your camp.

>  > I never know what to name timestamp/date fields.
>
>  What's your issue?  Not calling things "date"?  I tend to call things
>  "birth_date", "creation_date" etc.

Yeah, that's the crux of the problem.  I feel like it is something I
shouldn't have to think about, but every time I create a table I have
to stop and think:
"date_created or creation_date or created or date_added or add_date" and
"transaction_time or transaction_timestamp or transaction_datetime or
transaction_date"

Then I think, I'll just follow the last guys convention and discover
"the_date" is being used.  "the_date" is wrong on so many levels that
I can't stand the thought of repeating it.


>  All that aside, you didn't answer the burning question:  did my query
>  suggestion work?! :)
>

Yes of course!... but Kenneth beat you to it.  I had it in my head
that I wanted a flexible fallback path for languages like:
zh_CN' -> zh_TW -> zh_US -> en_US
fr_CA -> fr_FR -> en_us

When I actually asked the question, I simplified it.  After I saw how
elegant and simple the two language solution is, I decided it wasn't
worth the additional complexity to have the fallback path.

Cheers,
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





**************Need a new ride? Check out the largest site for U.S. used car 
listings at AOL Autos.      
(http://autos.aol.com/used?NCID=aolcmp00300000002851)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080424/64e962f5/attachment.html>


More information about the talk mailing list