Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

How should I name my Tables when creating a new database?

Singular: Client or Plural: Clients?

share|improve this question
    
I once had a co-worker who insisted that table names be singular and view names be plural. –  René Nyffenegger Feb 23 '12 at 8:59
1  
There are other schools of thought. 1) Use verbs that will allow one to express queries in natural language e.g. person NAMED 'fred' EARNS 20,000 (where the uppercase names are the tables). 2) use the enterprise's name for the set e.g. PERSONNEL, PAYROLL, ORG_CHART, etc. –  onedaywhen Feb 23 '12 at 9:10
    
Possible cross site duplicate: stackoverflow.com/questions/338156/… –  Ciro Santilli Jan 24 at 14:11

3 Answers 3

up vote 20 down vote accepted

Up to you. Just be consistent though.

Personally I prefer singular based on what each *row" stores: Order, Products etc. This matches my modelling ((via Object Role Modelling) where I use singular entities/types.

Edit:

One reason is that plural fails when you have link tables:
Orders, Products would give OrderProducts or OrdersProducts. Neither sounds correct

Or history tables (of course you can use schemas for this):
Orders -> OrdersHistory or (no!) OrdersHistories? Wouldn't Order-> OrderHistory be better?

share|improve this answer
2  
Should it always boils down to a Personal choice? What if there were 2 people working in one database design, then one might name tables as plural and the other as singular. Is there no valid reasoning as to why use Singular or Plural? –  John Isaiah Carmona Feb 23 '12 at 8:23
1  
@JohnIsaiahCarmona: added a reason –  gbn Feb 23 '12 at 8:28
1  
I agree about using singular as being the most sensible. This doesn't seem to be the popular opinion, if you look around at similar questions here and on SO, etc. Lots of people seem to take a programmerly view of tables as collections which should therefore have plural names. I think that maybe ORMs might be starting to break people of this (bad) habit. If your tables have plural names to begin with it makes it hard to distinguish parent and child navigation properties and to distinguish instance and collection objects for a table. –  Joel Brown Feb 23 '12 at 12:47
3  
Another reason in favour of Singular is if you have a rule that the PK is named after tablename, for example TablenameID or TablenameCode or tablename_id. With plural table names, you end up with Orders.OrdersID (which doesn't look right) or with Orders.OrderID where you use plural for table names but change to singular for column prefixes. –  ypercube Feb 27 '12 at 10:10
    
Another point along the same lines. –  Jack Douglas Jul 21 at 19:40

Just as @gbn's answer I think this is most a matter of preferences and just like him I recommend that any choice you made, apply it everywhere (in that DB at least). Consistency is worth it.

My preference, however is that a plural sounds better in SELECT statements :

SELECT Id, Name, Status 
FROM   Persons
WHERE  Status <> 5  --5 meaning deleted

I mean in this case, at least, there are several persons in the table and several of them are returned to the client.

share|improve this answer

Concerning singular versus plural table names, the subject seems to be controversial, but it shouldn't be.

While a table is a collection of multiple records, a table is named after the definition of the one type of record that it contains. If a table was allowed to have a different name than that of the type of record that it contains, you could give the table a plural name, so that you could for example have an Employees table containing multiple Employee records. But the designer of SQL did not provide for separate names for tables and record types.

Things work out more logically for object oriented programs that use the data, if the name of a record type (and by extension the table name) is kept singular, as it will correspond with the name of the class you would use to describe one record.

If you then want to identify a collection in the program, you can use a plural, or better, use an appropriate modifier, such as EmployeeList or EmployeeArray.

There is also a problem with irregular plurals for automatic code generation and programmers who have different language backgrounds or ideas about the formation of plurals in a program.

The English language is not a good and proper programming language, and trying to make database and program statements conform to English because it sounds better to read one of those statements is a mistake.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.