Re: naming conventions

From: Date: Fri, 27 Jul 2001 13:18:05 +0000
Subject: Re: naming conventions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59941@lists.php.net to get a copy of this message
Matthew, The convention I use goes as follows: [ I am doing this without testing as I go so if something is wrong, don't sue me :P ] Lets say I have two tables... PEOPLE people_id (primary key) people_namefirst people_namelast people_namemiddle people_age place_id (foreign key) PLACE place_id (primary key) place_name place_address place_numberphone place_numberfax What I do is use [tablename]_[fieldname]. This convention makes SELECT statements like this easy... SELECT people.people_id, people.people_namefirst, place.place_id, place.place_address FROM people, place WHERE people.place_id = place.place_id AND place.place_name = 'IBM'; Otherwise, it would be difficult to differenciate between place_id (the foreign key for the PEOPLE table) and place_id (the primary key for the PLACE table). -Jeremy Email: jer2475@home.com

« previous php.general (#59941) next »