Database Design-Online Bookstore System

1. Demand analysis

1.1 User Analysis

There are mainly three types of users in the online bookstore system: ordinary users, members and administrators.
Ordinary users: browse books, query books, register as a member, etc.;
members: browse books, query books, add to shopping cart, modify shopping cart, order books, generate and view orders, view and modify personal information, etc.;
administrators: browse books, Query books, view orders, process orders, view and modify personal information and update book information, etc.

1.2 Main functions of the system

After user analysis of the system, the main functional modules of the system can be designed as shown in the figure below:

insert image description here

1.3 Data Dictionary

The data dictionary designed through requirements analysis is shown in the following table:

relation Attributes illustrate
membership form Member email Used to receive platform information (verification messages, promotions, etc.)
Member Phone Ways to contact members when an order arrives
Member gender male or female only
member account Member ID, which can uniquely identify the member
Member's name member's real name
administrator table Admin gender male or female only
Admin Phone 11 valid numbers, the only way to contact the administrator
administrator salary The value must be greater than 0 and can only be Arabic numerals
administrator account Administrator number, which can uniquely identify the administrator and cannot be repeated
admin name Administrator's basic information
book list book price The amount that members need to pay when purchasing
Number of books The number of books remaining in the warehouse
book number Uniquely identifies the book for retrieval purposes
book title Can be used for query retrieval
order form order number Uniquely identifies the order and is used to query the order
order address Shipping to address
order date The time when the member placed the order can only be in date format and must be a legal date
purchase form order number Reference the order number in the order table
book number Reference the book number in the book table
Purchase quantity The number of books purchased by the user when placing the order

2. Conceptual structure design

The system designs the following entities:
Member: attributes include account number, name, gender, phone number, email address;
administrator: attributes include account number, name, gender, phone number, salary;
order: attributes include order number, address, date;
books: Attributes include book number, title, price, and quantity;
common users: no attributes.

The connection between these entities is as follows:
(1) Each member places multiple orders, and each order belongs to only one member.
(2) Each order can contain multiple book products, and each book product can appear in multiple orders.
(3) Each order can only be processed by one administrator, and one administrator can handle multiple orders.
(4) Each ordinary user, member and administrator can browse and view multiple books, and each book can be browsed and viewed by multiple users.
(5) Each ordinary user can only register as a member, and a member can only be registered as a member by an ordinary user.

After analyzing each entity and its attributes and the relationship between each entity, the following ER diagram can be designed. The following figure is the entity attribute diagram:

insert image description here

The following figure is the entity connection diagram:

insert image description here

The following figure is a complete ER diagram:

insert image description here

3. Logical structure design

Convert the ER diagram designed by the conceptual structure into a relationship model as follows (the code of the relationship is underlined):
Member (member account number, member name, member gender, member phone number, member email address)
order (order number, order address, order date , member account, administrator account)
book (book number, book name, book quantity, book price)
administrator (administrator account, administrator name, administrator gender, administrator phone, administrator salary)
purchase (order number, book number, purchase quantity)

4. Physical structure design

After selecting the appropriate physical structure for the logical data model of this system, the database and data tables can be designed as shown in the figure below:

insert image description here

Guess you like

Origin blog.csdn.net/m0_51755720/article/details/121551801