Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

DB Naming standards

  • 04-09-2003 10:07am
    #1
    Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭


    Does anyone know of any standards (or recommendations, or styles) for the naming of database objects.

    I'm starting a new project, and as well as doing everything consistently within the project, I'd like to also be able to say that standards X, Y, and Z were adopted.

    For example....I vaguely recall reading somewhere that in order to keep with ER concepts, database tables should always be named in the singular, and never in the plural (e.g. the Customer table, and not the Customers table). Only thing is that I haven't a clue if I read that or made it up (!).

    Any help???

    jc

    p.s. I am aware of Hungarian notation as an option, but I'm tending to shy away from it these days. Refactoring the database design can be just too damned messy as a result.


Comments

  • Registered Users, Registered Users 2 Posts: 79 ✭✭tendofan


    I favour naming tables in the singular, and avoiding hungarian notation in tables and field names.

    One place I worked in did this, but made exceptions for look-up tables, and link tables, i.e. key-only tables, to which they prefixed 'lut' and 'lnk' respectively.

    Another place used hungarian notation for the stored procedures and views ('sp' & 'v') in addition to the above.

    I'm not really sold on either way myself to be honest, though in a large DB project it's sometimes nice to know that you're getting your data from a stored procedure or a view.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    I would use singular names instead of plural too, makes more sense when reading queries. I can't think of any standards but if using hungarian notation for objects I'll use it as a suffix rather than a prefix so everything can be listed alphabetically.


  • Registered Users, Registered Users 2 Posts: 640 ✭✭✭Kernel32


    Using singular is a good way to go and is a common standard. Beyond that its up to you, but the golden rule is be consistent. An inconsistent standard is worse than no standard.


  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    I would suggest using plural names for tables and singular names for fields. I also prefix tables with "tbl". You should also have naming convention for linking tables. Normally, I just separate the table names with an underscore! As much as possible, you should name your fields so that you'd know what table they are from if you saw the field mentioned in some code! I normally prefix the fieldname with part of the table name.

    Examples:
    tblProducts contains a list of products

    prod_code is the product code of one product only!


Advertisement