To pluralise or not to pluralise...
What are people thoughts on pluralising table names i.e. users, orders? I know the Reactor model was against this, and in Transfer I've followed that suit, so I use User, Order etc.
Thanks in advance.
What are people thoughts on pluralising table names i.e. users, orders? I know the Reactor model was against this, and in Transfer I've followed that suit, so I use User, Order etc.
Thanks in advance.
It comes down to personal preference (a bit like CamelCase, and whether you name your tables just "contacts" or "tblContacts" etc..
Also - be careful of reserved words - some dbms reserve the word 'user' so you'll have problems there.
Why go through that, when everyone knows what the single instance is.
As for query names, I think singular makes sense because you are never really referring to more than one record at a time.
But, I agree with Tom - what ever you do, as long as it is consistent, you are good.
cfloop
#getUsers.USERS#
cfloop
#getUsers.USER#
To me the second one make logical sense. You are looping the plural object and grabbing the value from the singular object. The first one feels like I should also be looping USERS since it is plural.
I am slightly baffled about why there is emphasis on consistancy in the comments - surely that's something that applies to everything, not just database naming? :S
I think consistency is the answer.
Person can't be persons (people?)
Status is statuses not statuss (as mentioned above)
Mouse would be mice not mouses
And so forth. Effectively the variance between singular form and plural form varies wildly between words ranging from different spellings all together to just adding an s.
I'm also one of those that regularly uses "tbl", "tlkp" and "tlnk" prefixes on my database table names -- I'd rather type a mere 3 more character than wonder what the purpose is of a particular item in my database.
.02
Use singular. Most database tools will expect that and produce sesible results.
SELECT person.name FROM people AS person
Note the singular alias so that the column reference reads as a single item.