Database table names - singular or plural?
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
Well I prefer plural. And it makes sense when you fire a query like this
Select * from Customers where FirstName = 'BOB'
But may be thats just my opinion, it may vary for others.
Books are as useful to a stupid person as a mirror is useful to a blind person. - Chanakya
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
I prefer singular, especially while working with LINQ to SQL. It just makes everything so much simpler in my opinion :)
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
Klingon programmers just don't care about singular or plural, and would call 'City' the customer table, to deceive the enemy. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I prefer singular because it describes an instance of the record eg. CustomerProperty as opposed to CustomerProperties.
RyanEK wrote:
I prefer singular because it describes an instance of the record eg. CustomerProperty as opposed to CustomerProperties.
A table is a
Collection
of those records. Why the postfix? Isn't "Customers" more simple for a table, with "Customer" linguistically for a record?foreach
(Troll curTroll in Trolls) :) -
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
-
Klingon programmers just don't care about singular or plural, and would call 'City' the customer table, to deceive the enemy. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Patak! You gave the Empires' secrets to the Federation! Qo'nos will disown you... (Can we have a smiley with a cornish pasty on it's forehead?)
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
Singular, because it makes your column references grammatically more correct.
Select * from MyTable where MyTable.MyColumn = X
vs
Select * from MyTables where MyTables.MyColumn = X
Just all wrong.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
-
Klingon programmers just don't care about singular or plural, and would call 'City' the customer table, to deceive the enemy. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Klingons use a database? I thought they just wrote down stuff in sticky notes. :~
It is a crappy thing, but it's life -^ Carlo Pallini
-
Singular, because it makes your column references grammatically more correct.
Select * from MyTable where MyTable.MyColumn = X
vs
Select * from MyTables where MyTables.MyColumn = X
Just all wrong.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
Absotively! 5.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
Singular - without question. Grammar aside the tables in your database are (I assume) modelling entities and the relationships between them. Thus the 'customer' table is representing the Customer entity. If you consider the ERD of the database in question this distinction should become obvious. Also I would keep table names lowercase, but that is another issue :)
"I know you believe you understood what you think I said, but I am not sure you realize what you heard is not what I meant."
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
I think it's entirely down to personal preference, and I've used a mixture of both (gasp, the horror), for example, 'bk_customer_details' holds customer details, 'menudetails' holds the detail of a menu, and menulist holds a list of menus. I think Chris' example of mytable.mycolumn isn't the best - if the table held a list of my tables, I'd go for 'mytables.table_name = X' - it depends on what it's used for. Neil.
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
singular, of course if you think otherwise YOU are wrong in time you will see the light - meanwhile at least keep it consistent....
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
Depends what it is. If it's a table of user records, then the table should be named "Users", because each record is a single user. If it's a table of user details, which together represent a single user, then it should either be called "User" or "user_details" i.e. stick as close to possible to what you would use in plain English
I wanna be a eunuchs developer! Pass me a bread knife!
-
Singular, because it makes your column references grammatically more correct.
Select * from MyTable where MyTable.MyColumn = X
vs
Select * from MyTables where MyTables.MyColumn = X
Just all wrong.
cheers, Chris Maunder The Code Project Co-founder Microsoft C++ MVP
You used a perverse example :| 'MyTables' is not what you would typically call a table.
SELECT * FROM Customers WHERE [ID] = 205
SELECT * FROM Customer WHERE [ID] = 205The former looks far better to me. Having said that, you do have a point - if you are doing a join,
ON Customers.[ID] = Bills.CustomerID
looks odd. :~Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
I prefer the table name to be plural for readability and for consistency with my code. Usually I map, for example, a record from the Customers table to a Customer object, with the collection of records held in a Customers collection of some type.
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
Do you prefer table names in singular or plural? For instance, if you had a table to store customer records (ID, name, billing address, phone, etc), would you call the table
Customer
orCustomers
?Cheers, Vikram. (Proud to have finally cracked a CCC!)
Recent activities: TV series: Friends, season 10 Books: Fooled by Randomness, by Nassim Nicholas Taleb.
Carpe Diem.
I prefer singular. I once worked for a company where they insisted on plural, but I just don't see the point; if everything is plural then it just doesn't mean anything so why do it? "If everyone is somebody then no one's anybody." -- Gilbert and Sullivan