SitePoint Sponsor

User Tag List

View Poll Results: plural or singular tables names?

Voters
17. You may not vote on this poll
  • Plural

    3 17.65%
  • Singular

    14 82.35%
Results 1 to 18 of 18
  1. #1
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question plural or singular tables names?

    i saw a thread over on vBulletin's forum where someone was suggesting that vB's `user' table be renamed to `users' etc. i agree with this and think plural names (users, cities, posts vs user, city, post) make more sense. however, our Wayne said that a plural name is bad database design.

    so, what do you all think?
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dunno enough about database principles but i'd say that naming it plurals makes it easier to read when you have say,
    Code:
    SELECT users, posts FROM dinner_table;
    since you want all the users and posts...

    <edit>oh yes i've to say that i'm not particular, so i use both plurals and singulars</edit>
    Last edited by redemption; May 30, 2002 at 23:22.

  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer singular names for things that hold data. I can refer to the author of an article in an SQL query by "article.author," not "articles.author," which just sounds weird.

    Also, I use singular hash names. $fruit{apple} instead of $fruits{apple}.

  4. #4
    SitePoint Evangelist Umair.ms's Avatar
    Join Date
    Sep 2000
    Location
    Lahore, Pakistan
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer singular names.
    TinyPlanet.org
    Discuss and Debate World Events, Politics and Religion.
    Interact and Share your Views with People around the Globe.

  5. #5
    \m/ R.I.P. Dimebag! \m/ JimBolla's Avatar
    Join Date
    Dec 2001
    Location
    erie, pa
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i prefer singular names because it makes copy/pasting easier, especially when you deal with entities that end in the letter "y" that become "ies" when pluralized. i think plural looks better but for pragmatic reasons, i vote for singular.
    -- JIM BOLLA
    Wanna play Halo 2? My XBOX Live gamertag: crowdozer

  6. #6
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,294
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    I voted singular because the table is a collection of an item, and each record represents a single entity (ie a record on a user table represents one specific user)

    at least that's what I was taught in my DB design class, so that's what I stick with.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  7. #7
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer using plural names for columns and singular names for tables I never knew there was a db etiquete for naming of db's though
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  8. #8
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by DaveMaxwell
    I voted singular because the table is a collection of an item, and each record represents a single entity (ie a record on a user table represents one specific user)
    yeah, that's what Wayne said. i'm the only one who voted plural so far. i'm starting to rethink it now, though.

    thanks guys.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  9. #9
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Singular. In the past I used plurals, but I am now older & wiser!!!

    I second CrowDozer's point about the problems of inconsistent pluralization.

    (Not to mention that "it's the way you're supposed to do it" !!!)


    M@rco

  10. #10
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always use plural...

    It doesn't really make a difference to me, but that's how I started doing it. It's only a name after all.

    -cARL
    Ohai!

  11. #11
    SitePoint Zealot raymo's Avatar
    Join Date
    Feb 2002
    Location
    The High Country, Victoria, Australia
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    plural

    Originally posted by redemption
    Code:
    SELECT users, posts FROM dinner_table;
    I agree. I started naming tables plurally from the beginning and have never faltered.

    As for the 'correct' way - I don't see how either could be unconventional or 'wrong'.
    Last edited by raymo; Jun 4, 2002 at 02:13.
    ride it like it's stolen

  12. #12
    SitePoint Enthusiast
    Join Date
    Dec 2001
    Location
    London
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does it really matter whether you use plural or singualr names for tables?

    As long as the table name is appropriate to the data it is holding and you are consistent with your naming convention then i don't think there is really an issue.

  13. #13
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In theory --> singular
    In practice --> whatever you prefer

    I have added a couple more links to the DB resources thread I started this morning which cover general principles on naming & other design considerations, including of singular/plural table naming.

    http://sitepointforums.com/showthrea...636#post465636


    M@rco
    Last edited by M@rco; Jun 12, 2002 at 20:00.

  14. #14
    SitePoint Member Spiff Dog's Avatar
    Join Date
    Jun 2002
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by M@rco
    In theory --> singular
    In practice --> whatever you prefer

    I have added a couple more links to the DB resources thread I started this morning which cover general principles on naming & other design considerations, including of singular/plural table naming.

    http://sitepointforums.com/showthrea...636#post465636


    M@rco
    I tend to agree with M@rco and name them whatever seems most apt at the time.

    However, I usually use singular names because of the afore mentioned plural suffix discrepencies.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    "Home is where you hang your @."
    Spiff Dog Design

  15. #15
    SitePoint Zealot raymo's Avatar
    Join Date
    Feb 2002
    Location
    The High Country, Victoria, Australia
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by M@rco
    [B]...I have added a couple more links to the DB resources thread...
    Wouldn't that be DB resource thread, in your book? :oP
    ride it like it's stolen

  16. #16
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer plural fro table names, singular for rows.

    CREATE TABLE USERS(
    user varchar(50)
    )
    Originally posted by qslack
    I prefer singular names for things that hold data. I can refer to the author of an article in an SQL query by "article.author," not "articles.author," which just sounds weird.

    Also, I use singular hash names. $fruit{apple} instead of $fruits{apple}.
    To avoid this I just give an alias to the table, ie

    SELECT A.author from authors A, posts;

    Paul

  17. #17
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by raymo
    Wouldn't that be DB resource thread, in your book? P
    Yes, very clever...!


    M@rco

  18. #18
    SitePoint Zealot raymo's Avatar
    Join Date
    Feb 2002
    Location
    The High Country, Victoria, Australia
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ride it like it's stolen


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •