"StackOverflow Good question" SQL table name, should use plural or singular

Source: Internet
Author: User

problemThe SQL table name, which should be used as the plural or singular form of the resource object. For example, a user table, the table name is user or users more appropriate?
Essence Answer
The singular form is better, for the following reasons:
1, the concept is intuitive. You have a bag, there are a lot of apples inside, you will say this is an apple bag. But whether it's 0, 1, million apples, it's still a bag. The same is true of tables, which indicate the need to describe clearly the objects contained in the table, not how many data they have.
2, the convenience ofThe singular form is much simpler. Some words, its plural form may be unconventional, or there is no plural form, but the singular is different, singular form is not so much attention. Some of the words of the plural, may think you head big, may have to good Google to come out
3. EleganceIn particular, some master-detail forms of resource names, unified with the singular, read more convenient, alignment more orderly, from the order more logical. Compare the next singular:
    • Order
    • OrderDetail
Plural:
    • OrderDetails
    • Orders

4. Simple and plainImagine, whether it is the table name, the primary key, the relationship, the instance classes, you can unify the singular, all seem so unified, do not bother to change your mind in the plural singular
    • Customer
    • Customer.customerid
    • CustomerAddress
    • Public Class Customer {...}
    • SELECT from Customer WHERE CustomerID = 100
Once you are sure that the object to be processed is named customer, then all interaction with the database and programming will use the word
5. GlobalizationImagine that you are in a global team, some of whom are not native English, and for them, it is more difficult to identify and write the plural forms of a word, to bring trouble to them, and to bring trouble to team work.
6. Why notThis can save your spelling time, hard disk space, and even make your keyboard more "longevity"
    • SELECT customer.customername from Customer WHERE customer.customerid = 100
    • SELECT customers.customername from Customers WHERE customers.customerid = 100
Looking at these two statements, you can save 3 letters, 3 bytes, and 3 strokes of a keyboard.
Finally, I also think that you should add a prefix to some conflicting names, such as user, to add the corresponding prefix, that is, user > Loginuser, appuser, systemuser, Cmsuser,...
StackOverflow Link: http://stackoverflow.com/questions/338156/table-naming-dilemma-singular-vs-plural-names

Column Introduction: very like StackOverflow, can always find a solution to the problem of incurable diseases. Accidentally found that the site has a list of heat. So select some of the higher heat problems, and then according to their own understanding, the discussion of the people to comb out. Therefore, these articles are not true translation, but in accordance with their own understanding of a number of additions and deletions, polishing, hoping to put the above discussion, more streamlined and effective sharing to everyone. if you want to reprint, please specify the original addressHttp://blog.csdn.net/lizeyang

"StackOverflow Good question" SQL table name, should use plural or singular

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.