Essays-Relationship of database tables

Source: Internet
Author: User

One

Scene:

Web page through the user name and password landing to the homepage of the site, but also to know the user's details, such as home address, education, contact telephone, whether married, entry/departure time and other information;

General website Registration when registering a user name and password, and then you enter the site, prompting you to improve the personal information;

Build table:

A base_user table with ID, username, password

A user table with Base_user ID, home address, educational background, contact number, married, entry/departure time


Many-to-one (set the associated field on multiple sides), a-to-many (set the associated field on many sides), many-to-many (intermediate table)
Scene:

Fund industry, fund product information, net Fund product, fund product announcement, fund manager

Fund product information and fund products net value is a one-to-many relationship, a product work date has a net production;

Fund product information and fund product announcements is a one-to-many relationship, each product has a number of articles introducing the product, these articles are for the product;

Fund product information and fund managers are many-to-many relationships, a product has a number of product managers in the management, a manager to manage a number of products;

Build table:

Fund product information: ID, product name, product size, date of incorporation, risk-benefit characteristics, product type, minimum subscription amount, etc., but the product type is more than one product may be the same type, so you can put the type of product in a table, easy to manage

(The relationship between fund product information and product type is many to one);

NET value of the fund product: ID, ID of the associated product, unit value, date, etc.

Fund announcement: ID, associated Product ID, content, date, etc.

Fund managers and fund products are many-to-many relationships, with an intermediate table

Intermediate table information: ID, fund manager ID, fund product ID, appointment time, separation time, etc.

Fund manager: ID, name, education, whether married; but in the manager, some information in the manager's personal CV can be individually designed for a table, such as from educational situation, work experience, work in that job, etc.


Outside the topic:

Users and roles, roles and menus, roles and site columns are many-to-many relationships


Background CMS Management:

One-to-one situation, display your ID, user name, last login time and then click on a button to pop up a fill in the details of the information entered into the details of the table, ID is the user's ID;

One-to-many or many-to-one on a multiple (association ID) side provides a select drop-down box that selects one of that ID;

Many-to-many, can be separate for the intermediate table input, you can also use radio to select, and then insert into the intermediate table (such as user and role relationship, the user is the role is many-to-many relationships, but usually to let the user choose multiple roles, the same role can be more than one person);







Essays-Relationship of database tables

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.