I am a fan of singular table names as they make my ER diagrams using CASE syntax easier to read, but by reading these responses I'm getting the feeling it never caught on very well? I personally love it. However, I think for my personal conventions, I'll stick with plural table names. Honestly, I will be rethinking my position on the matter, and I would rely on the actual conventions used by the organization I'm developing for. ![]() However in the following two examples, the former makes more sense: SELECT * FROM cars WHERE color='blue' I'll admit that specifying the table along with the field in a table.field manner is the best practice and that having singular table names is more readable. Thus the plural form for the table name.Ī table of cars would have the name cars and each row is a car. Each row is an entity and the table contains many entities. In a normalized database, each table contains specific sets of data. A table name usually describes what the table contains. I can understand the argument for singular table names, but to me plural makes more sense. Up until this point I've always used plural. I've actually always thought it was popular convention to use plural table names. I like to think of it as messy, but systematic - and this way there is always a systematically generated name for the relation I wish to express, which to me is very important. to distinguish the table/relation name from the plural s. In textual descriptions, I end up using plural for increased readability - then use fonts etc. In my code, then, and in the database schema, I use singular. In other words, when I think about entities and how they are related I think of relations in singular, but of course, when I think of the entities in collections or sets, the collections or sets are plural. ![]() The AppUserGroup_AppUserGroup relation tells me how AppUserGroups and AppUserGroups are related (i.e. The AppUser_AppUserGroup relation tells me how the AppUsers and AppUserGroups are related. The AppUserGroup relation tells me which entities are AppUserGroups So, the AppUser relation tells which entities are AppUsers. My main argument is that I don't think of the tables as a set but as relations. We are trying to map a language with highly irregular grammar and semantics (normal spoken and written language) to a highly regular (SQL) grammar with very specific semantics. No matter what you do it is a mess, just pick a convention and stick to it. I don't buy any argument involving which is most logical - every person thinks his own preference is most logical.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |