Singular.  I myself use tbl Prefixes as I like it...no right or wrong here
other than the fact the table names like Stephen noted should be generic
rather than specific.


-----Original Message-----
From: Calvin Ward [mailto:[EMAIL PROTECTED] 
Sent: 30 March 2005 13:21
To: CF-Talk
Subject: RE: Table name - Singular or plural?

Now you're delving into normalization, which is loosely connected, but not
tightly coupled, with table/view/etc. naming conventions.

I prefer to use the singular myself for the reasons already listed such as;
the name represents the collection, which is a singular set, references make
more sense, plural forms are inconsistent.

The only apparent benefit to plural is that you can be said to reference the
entities (plural) inside the record set. But in my opinion, compared to the
reasons to choose singular, that really isn't that compelling.

I also don't like to use tbl as a prefix, however using a prefix for link
tables, views, stored procedures, etc. seems fine.

- Calvin

-----Original Message-----
From: Stephen Moretti (cfmaster) [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 30, 2005 6:41 AM
To: CF-Talk
Subject: Re: Table name - Singular or plural?

Will Tomlinson wrote:

>>This is the exact reason I gave it ago with singular table names.
tblPeople,
>>with a PK of PersonID or PeopleID didn't sit too well, tblPersons didn't
>>seem right either.
>>    
>>
>
>
>When I was reading through this thread, I started asking myself who names a
table tblpeople anyway? lol! I know I have less experience than most on the
list, but I've never built a tblperson or tblpeople. What does tblperson
represent?
>
>tbldoctors
>tbllawyers
>tbladministrators
>tblemployees
>tblusers
>
>Where would I use tblperson and need to make it plural anyway? What does
tblperson represent? Wouldn't you use something more specific? 
>  
>
Nope.  You use something generic.
If you have tblDoctor, tblAdmin, tblLawyers, what happens when you have 
another type of job? Say nurses or barristers?  You'd have to create 
another table and a whole bunch more logic to handle them within your 
application.

If you use something more generic then you can add as many "jobs" as you 
like with only minor changes to your application logic to handle the 
additional types.

tblEmployee is ok as is tblUser, because these are both fairly generic, 
allowing you to add as many employees or users as you like and then 
apply a job title/description to an employee (director, secretary, 
doctor, nurse) and roles to users (user, administrator, moderator).

Below is an example of storing a person's details and being able to 
assign them to multiple "types".  If you only wanted to allow a person 
to have one "type" you would place "PersonTypeID" in tblPerson as a 
foreign key.

tblPerson
=======
PersonID
Name
Address
TelNo

lnkPerson2PersonType
===========
PersonID
PersonTypeID

tblPersonType
==========
PersonTypeID
Title
Description

tblPerson
----------
PersonID Name                   Address                       TelNo
1              Stephen Moretti   Newcastle Upon Tyne  0845 226 2896

tblPersonType
---------------
PersonID Title             Description
1               Director     Company Director
2               Developer  ColdFusion Developer

lnkPerson2PersonType
------------------------
PersonID   PersonTypeID
1               1
1               2

Now with tblPersonType, I can add as many types as are needed by the 
application and add more when I realise I've missed some.  I can be 
anything I want, doctor, nurse, evil genius..... just by adding the type 
to the table and linking the person to the new type.

PersonID Title             Description
3              Evil Genius  Austin Power's latest nemesis

lnkPerson2PersonType
------------------------
PersonID   PersonTypeID
1               3

I hope that makes sense.

Regards

Stephen
PS.  Please excuse the "evil genius" stuff....  Having one of those 
mornings..... :D






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200664
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to