Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Database table names - singular or plural?

Database table names - singular or plural?

Scheduled Pinned Locked Moved The Lounge
databasecomsalesquestion
19 Posts 18 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Vikram A Punathambekar

    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 or Customers?

    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.

    C Offline
    C Offline
    Chris Maunder
    wrote on last edited by
    #10

    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

    H V 2 Replies Last reply
    0
    • C CPallini

      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]

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #11

      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

      1 Reply Last reply
      0
      • C Chris Maunder

        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

        H Offline
        H Offline
        Henry Minute
        wrote on last edited by
        #12

        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.”

        1 Reply Last reply
        0
        • V Vikram A Punathambekar

          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 or Customers?

          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.

          A Offline
          A Offline
          AlphaMatrix
          wrote on last edited by
          #13

          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."

          1 Reply Last reply
          0
          • V Vikram A Punathambekar

            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 or Customers?

            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.

            N Offline
            N Offline
            neilarnold
            wrote on last edited by
            #14

            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.

            1 Reply Last reply
            0
            • V Vikram A Punathambekar

              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 or Customers?

              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.

              M Offline
              M Offline
              Member 1709723
              wrote on last edited by
              #15

              singular, of course if you think otherwise YOU are wrong in time you will see the light - meanwhile at least keep it consistent....

              icalburner

              1 Reply Last reply
              0
              • V Vikram A Punathambekar

                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 or Customers?

                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.

                M Offline
                M Offline
                Mark_Wallace
                wrote on last edited by
                #16

                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!

                1 Reply Last reply
                0
                • C Chris Maunder

                  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

                  V Offline
                  V Offline
                  Vikram A Punathambekar
                  wrote on last edited by
                  #17

                  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] = 205

                  The 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.

                  1 Reply Last reply
                  0
                  • V Vikram A Punathambekar

                    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 or Customers?

                    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.

                    D Offline
                    D Offline
                    Dr Walt Fair PE
                    wrote on last edited by
                    #18

                    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

                    1 Reply Last reply
                    0
                    • V Vikram A Punathambekar

                      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 or Customers?

                      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.

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #19

                      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

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups