Database Design-name Mode)

Source: Internet
Author: User

 

Name-value mode: it is usually used to describe objects that cannot completely determine attributes in the system design phase. The attributes of these objects are greatly changed during system operation, or the attributes of multiple objects are very different. The following is an example (Note: This example has been simplified to a considerable extent. It is only used to help you understand the concept of "name-value mode". Please note that ). 1. When using the name-value mode for design, if you only browse and save "other attributes" without any special processing, a "attribute template" table is usually designed, the data records of this table are dynamically maintained during system operation. When the system is running, if you need to maintain "Other product attributes", you can first select an attribute name from the "Property template", and then fill in the "property value" to save, the system will save the corresponding product ID, property template ID, and the newly entered "property value" in "Other product attributes", so that the relevant settings are complete. No matter how the other property requirements of the product change, how to add, delete, or modify attributes can be implemented at runtime, without having to modify the database design and Program Code . 2. When using the name-value mode for design, if you have special processing for "other attributes", such as statistical summary, this attribute name must be hard-coded in the program code ", that is, the property name needs to be reflected in the program code. In this case, you can directly record the "property name" in the "other product attributes" table, instead of the "Property template" table. When the system is running, if you need to maintain "Other product attributes", the program will directly list "attribute names", and then fill in "attribute values" to save, the system saves the corresponding product ID, property name, and the "property value" that you just filled in to "other product attributes". This completes the relevant settings. In the future, if the demand changes, you only need to modify the corresponding program code without modifying the database design.

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.