Four design patterns of the database

Source: Internet
Author: User

The general use principle of four main design patterns of database design

1. Main expansion mode

The main extension mode is often used to extract common properties of several similar objects, forming a "common attribute table", and "public attribute table" and "proprietary attribute table" are "one to the other" relationships.

The "proprietary attribute table" can be seen as an extension of the "Public attribute table", which together is a complete description of a particular object, hence the name "main extension mode".

There are not many objects, the attributes of each object are different, the properties of each object can be fully determined during the database design phase, and the individual extension objects have independent, relatively complex business processing requirements, with "main extension mode". The common attributes of each object are drawn out to be designed as "main Table", the remaining properties of each object are designed as the corresponding "extension table", and "Main Table" has a one-to-one relationship with each "extension table" respectively.

2. master-Slave mode

Master-Slave mode, is the most common in database design mode, is also the most used in daily design work of a model, he described the two tables between the master-slave relationship, is a typical one-to-many relationship.

The number of objects is not fixed; the properties of the objects are almost no different; The object's properties are fully determined during the database design phase, and the individual objects do not have separate business processing requirements, with master-slave mode. Create a one-to-many relationship with the main Table object by designing individual objects as records from tables.

3. Name Value mode

A name-value pattern, typically used to describe an object that is not fully deterministic during the system design phase, where the properties of these objects change greatly when the system is running, or there is a big difference between the properties of the objects.

The number of objects is very large, the properties between the objects are very different, the object properties can not be determined during the database design phase, or there are large changes when the system is running, and the individual objects do not have separate business processing requirements, with "Name value mode".

4. Multi-to-multi mode

Many-to-many mode, is also a more common database design pattern, he described the two objects part of the primary and secondary, the status of equivalence, mutual one-to-many relationship.

Many-to-many modes require an association table between two tables, which is the core of many-to-many relationships.

Two objects are one-to-many relationships, use multi-to-many mode.

Four design patterns of the database

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.