NYCPHP Meetup

NYPHP.org

[nycphp-talk] Database, table, and column naming schemes

Russ Demarest rsd at electronink.com
Sat Sep 12 21:44:57 EDT 2009


Matt,

This is how I originally learned it way back when and still believe.
SQL should read almost like english.

Tables are named in the plural.
Columns are singular.
id columns are the table name singular "_id".

For example.

create table users (
	user_id int auto_increment not null,
	username varchar(20)
	);


I have used simple id columns which works fine too but using the  
table_id concept can make things easier down the road.

Perhaps explaining what your current method is might make it easier  
for us to suggest a solution.

Hope it Helps.

On Sep 12, 2009, at 8:17 PM, matt at atopia.net wrote:

> Does anyone have any good naming conventions for mysql databases and  
> tables and columns?  I'm developing a complex lamp project now, and  
> my normal convention doesn't seem to want to work too well for this  
> project - there are a few conflicts.
>
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list