MyBatis Series -09-Order commodity data Model

Source: Internet
Author: User

9.1 Data Model Analysis Ideas

1, the data content of each table record

The sub-module is familiar with the contents of each table record, which is equivalent to the process of learning the system requirements (functions).

2. Important field settings for each table

Non-null field, foreign key field

3. Relationship between database-level tables and tables

FOREIGN key relationships

4. Business relationship between table and table

When you analyze the business relationship between tables and tables, you must build on a business sense basis to analyze them.

9.2 Data Model Analysis

Users table User:

Record the user information of the purchased item

Order Form: Orders

Records the orders created by the user (orders for items purchased)

Order Schedule: OrderDetail:

The details of the order are recorded as information about the purchase of the goods

Product List: Items

Record the product information

A business relationship between a table and a table:

The analysis of the business relationship between tables and tables needs to be built on a business sense basis.

Analyze the business relationship between tables that have a relationship between data levels first:

Usre and Orders:

User---->orders: You can create multiple orders, one-to-many

Orders--->user: An order is created by only one user

Orders and OrderDetail:

Orders-àorderdetail: An order can include multiple order details, because an order can buy multiple items, each item's purchase information is recorded in the OrderDetail, a one-to-many relationship

Orderdetail--> Orders: An order detail can only be included in one order

OrderDetail and ITESM:

Orderdetail-àitesms: An order detail corresponds to one product information

Items--> OrderDetail: A product can be included in multiple order details, one-to-many

Re-analyze whether there is a business relationship between tables that do not have a relationship at the database level:

Orders and items:

Relationships can be established between orders and items through the OrderDetail table.

MyBatis Series -09-Order commodity data Model

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.