Singular or Plural

  • The description column in the documentation next to the object name is the thing that is often the most useful.

    It would be funny to just create the alternative view (singular/plural) and then see what gets used 🙂

    Case 1 with table customer:
    Create view AS CUSTOMERS AS select * from customer
    GO

    Case 2 with the table CUSTOMERS:
    Create view CUSTOMER AS select * from customers
    GO

    412-977-3526 call/text

  • I very much prefer to use plural for naming tables, like People rather than Person. To me, it conveys what's in the table (a set of people), rather than a description of any record within the table. Where I work they tend to use singular rather than plural. It irritates me, but at the end of the day it doesn't matter.

     FWIW, if you develop an application in C# or VB.NET and use Entity Framework's database designer to create a .EDMX file, you'll see that EF will make plural any table named Person, Place, etc.

    Kindest Regards, Rod Connect with me on LinkedIn.

  • Rod at work - Friday, December 8, 2017 9:21 AM

    ...
     FWIW, if you develop an application in C# or VB.NET and use Entity Framework's database designer to create a .EDMX file, you'll see that EF will make plural any table named Person, Place, etc.

    Entity Framework database designer database designer, you say? Oh, will that just settles it then.  😛

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Eric M Russell - Friday, December 8, 2017 9:41 AM

    Rod at work - Friday, December 8, 2017 9:21 AM

    ...
     FWIW, if you develop an application in C# or VB.NET and use Entity Framework's database designer to create a .EDMX file, you'll see that EF will make plural any table named Person, Place, etc.

    Entity Framework database designer database designer, you say? Oh, will that just settles it then.  😛

    The big thing is that the developer can change the DBA's quirks to her own. All the same, the designer has an end of life in view since no further renditions of EF will support it.

    The big thing to me is constancy. I really don't care if a table is name Person, Persons, or People. As for amount of typing I would say to learn the joys of auto-completion.  Otherwise you could really get shorter and name the table Ppl.

  • Just to reiterate what some others have stated: Consistency is King!  Like with many other programming conventions, however it's done is not really as important as long as it's done consistently.  While I have my personal preferences, I follow whatever conventions are already in place unless there is a very valid reason to change them.  If such a change is necessary or simply opportune, I make sure that it's done completely and consistently.  Documentation is also important especially for the poor schmucks that have to follow me! :hehe:

  • RonKyle - Friday, December 8, 2017 7:31 AM

    I would push back on anything that prefixes an object to tell you what type of object it is such as tbl, vw, fn, usp etc

    I would push back on your push back.  For starters, prefixes are an excellent way to avoid reserved words.  I hate worked with tables where I have to remember to put the brackets around Date when dtmCompleted or dtCompleted will do just fine.

    I'd have a table storing SQL & ODBC reserved words and have a test that does a RAISERROR if a reserve word is detected in any DB object.

    I avoid tbl, vw etc because I've had to refactor views as tables and vice verse making the prefix invalid.  Prefixes were a misconstrued understanding of what Simonyi's was getting at when Hungarian notation was invented

  • I used to feel like it was just a matter of perspective, but after having used TVPs I'm firmly in the plural camp. Naming collisions between tables and table types can be a real hassle.

  • I read five database design books last year.  They all firmly said to use singular nouns as table names.

  • David.Poole - Friday, December 8, 2017 11:04 AM

    I avoid tbl, vw etc because I've had to refactor views as tables and vice verse making the prefix invalid.  Prefixes were a misconstrued understanding of what Simonyi's was getting at when Hungarian notation was invented

    Even if it isn't the idea predates static typing. Thus static typing and the modern ide naturally changes the way we look at things. As a note, in some cases the consumer has no concern if this is a view or a table since SQL server will happily allow simply views to be updatable with no effort, and any view with the use of a trigger.

  • I use plural, because the table represents a set of objects, not a single object.

    And that also saves me the grief of JC telling me that I need to read a book on database design. 😀

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • drew.allen - Friday, December 8, 2017 12:53 PM

    I use plural, because the table represents a set of objects, not a single object.

    And that also saves me the grief of JC telling me that I need to read a book on database design. 😀

    Drew

    I could care less what JC has to say.  😀

  • Lynn Pettis - Friday, December 8, 2017 1:09 PM

    drew.allen - Friday, December 8, 2017 12:53 PM

    I use plural, because the table represents a set of objects, not a single object.

    And that also saves me the grief of JC telling me that I need to read a book on database design. 😀

    Drew

    I could care less what JC has to say.  😀

    Talking about Joe? Invoke his name, and he shall appear. 🙂

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • Eric M Russell - Friday, December 8, 2017 2:12 PM

    Lynn Pettis - Friday, December 8, 2017 1:09 PM

    drew.allen - Friday, December 8, 2017 12:53 PM

    I use plural, because the table represents a set of objects, not a single object.

    And that also saves me the grief of JC telling me that I need to read a book on database design. 😀

    Drew

    I could care less what JC has to say.  😀

    Talking about Joe? Invoke his name, and he shall appear. 🙂

    Only if you say it three times while looking in a mirror! :hehe:

  • Singular. I teach singular and I beg people to use Singular. Not only do we not have to remember if there is or isn't an S if we just know that table names are singular, we also don't have to worry about the problem of "ys" vs "ies" which seems to confound many of our ESL friends and coworkers. 

    It also makes thing simpler when you're creating or using automation tools- a many to many join table between puppies and foods isn't puppy_foods or puppies_food or puppies_food or foods_puppies or food_puppies or foods_puppy it's just the table names, singular, in alphabetical order: food_puppy, and when a piece of automation finds a table with underscore(s) it can just know that the entities parsed out will exist as tables. If I see food_puppy, I know there is a food table and a puppy table, and I also know that the PK in those table is (a) the first field (b) a unique identifier (c) a rowguid (d) named FoodRecordID and PuppyRecordID. I know the first two fields in the Food_Puppy table are also FoodRecordID and PuppyRecordID. 

    The best part about the singular naming, from an automation standpoint, is that if my code finds a field that ends in "recordid" then there is guaranteed to be a table named whatever was before the recordid part. I don't have to know that puppyrecordid is in the puppies (or puppys) table. I just chop the recordid and what remains will be a table name, without any other worries. or... should I say... without a further worry. 🙂

  • kiwood - Friday, December 8, 2017 9:52 AM

    Eric M Russell - Friday, December 8, 2017 9:41 AM

    Rod at work - Friday, December 8, 2017 9:21 AM

    ...
     FWIW, if you develop an application in C# or VB.NET and use Entity Framework's database designer to create a .EDMX file, you'll see that EF will make plural any table named Person, Place, etc.

    Entity Framework database designer database designer, you say? Oh, will that just settles it then.  😛

    The big thing is that the developer can change the DBA's quirks to her own. All the same, the designer has an end of life in view since no further renditions of EF will support it.

    The big thing to me is constancy. I really don't care if a table is name Person, Persons, or People. As for amount of typing I would say to learn the joys of auto-completion.  Otherwise you could really get shorter and name the table Ppl.

    I haven't heard anything about the end of life of EF. Really?

    Kindest Regards, Rod Connect with me on LinkedIn.

Viewing 15 posts - 31 through 45 (of 81 total)

You must be logged in to reply to this topic. Login to reply