How should I name my Tables when creating a new database?
Singular: Client or Plural: Clients?
|
How should I name my Tables when creating a new database? Singular: |
|||
|
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: Or history tables (of course you can use schemas for this): |
|||||||||||||||
|
|
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
I mean in this case, at least, there are several persons in the table and several of them are returned to the client. |
|||
|
|
|
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. |
||||
|
|
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