Table naming...

  • Hi,

    I was trying to get a "rule" for table naming but it's kind of hard to do it since every case is a casa...

    You can have a table Customers - it ok, since it's in the plural and each row has a customer.

    But if you have a reference table to Customers, say its addresses, how should the table be named?

    CustomerAddresses, CustomersAddresses or CustomersAddress? Is there a "rule" for this or just go with what sounds better?!

    Just like you can have a SalesOrders and SalesOrderDetails or SalesOrdersDetails...

    Thanks,

    Pedro



    If you need to work better, try working less...

  • PiMané (10/25/2012)


    Hi,

    I was trying to get a "rule" for table naming but it's kind of hard to do it since every case is a casa...

    You can have a table Customers - it ok, since it's in the plural and each row has a customer.

    But if you have a reference table to Customers, say its addresses, how should the table be named?

    CustomerAddresses, CustomersAddresses or CustomersAddress? Is there a "rule" for this or just go with what sounds better?!

    Just like you can have a SalesOrders and SalesOrderDetails or SalesOrdersDetails...

    Thanks,

    Pedro

    Rarely do I use plural in anything as far as naming, since it doesnt lend anything. Tables are rows... its intuitive. Therefore... Customer represents a table of rows representing customer data. CustomerAddress, again, making it plural doesnt make it any more clearer, so why do it.

    When I have associative entity tables, I break convention, if only to clue developers in that its special; let's assume Customer and Address in your example are many to many, instead of one to many. I would name it AE_CustomerAddress. This lets devs know they are only getting relationship data here.

    But thats just me, your mileage may vary.

  • PiMané (10/25/2012)


    Hi,

    I was trying to get a "rule" for table naming but it's kind of hard to do it since every case is a casa...

    You can have a table Customers - it ok, since it's in the plural and each row has a customer.

    But if you have a reference table to Customers, say its addresses, how should the table be named?

    CustomerAddresses, CustomersAddresses or CustomersAddress? Is there a "rule" for this or just go with what sounds better?!

    Just like you can have a SalesOrders and SalesOrderDetails or SalesOrdersDetails...

    Thanks,

    Pedro

    Hi,

    There is not a written rule for this. It is up to you. Technically all will pass. But it is a good thing if you follow one. I think keeping singularity for names is better. E.g. Customer, CustomerAddress, CustomerAddressDetail ...

    I'd like also to hear from the others on this question.

    Thanks

    IgorMi

    Igor Micev,My blog: www.igormicev.com

  • IgorMi (10/25/2012)


    PiMané (10/25/2012)


    Hi,

    I was trying to get a "rule" for table naming but it's kind of hard to do it since every case is a casa...

    You can have a table Customers - it ok, since it's in the plural and each row has a customer.

    But if you have a reference table to Customers, say its addresses, how should the table be named?

    CustomerAddresses, CustomersAddresses or CustomersAddress? Is there a "rule" for this or just go with what sounds better?!

    Just like you can have a SalesOrders and SalesOrderDetails or SalesOrdersDetails...

    Thanks,

    Pedro

    Hi,

    There is not a written rule for this. It is up to you. Technically all will pass. But it is a good thing if you follow one. I think keeping singularity for names is better. E.g. Customer, CustomerAddress, CustomerAddressDetail ...

    I'd like also to hear from the others on this question.

    Thanks

    IgorMi

    if you wanted to be a real joker you could name a table * ([*]) i find that if you are consistent and enforce the rules it does not matter its when you start having customers and company that things break down. There is an ISO standard out there if you really want some other person to tell you how to name your tables but ill leave that for some one else.


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

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