webnovel

Simple online bookstore database design

2024-09-23 00:15
Not many requirements. User ID, account password, ID, title, author, etc. in the table. How do I save which user bought which book? Should I add a username to the library and build a relationship diagram? Or was he going to build a table to save it? I just don't understand how to make sure that the book A buys is the book A buys, and not all users buy it. How do I design this relationship diagram? There's no need to classify the books or anything.
1 answer

The database design of the online bookstore should include the following components: 1. Item Information Table (Item) -Store the basic information of the item such as title, author, price, description, classification, etc. 2. Order Information Table ( Order) -Store the order information of the customer, including the order number, customer name, order status, order items, etc. 3. Stock-Storage of stock information, including item number, stock quantity, purchase date, supplier, etc. 4. Order Management-used to record all orders created, modified, deleted, and the status of the order (completed, in progress, not processed, etc.). 5. Customer Information Form-used to record the basic information of the customer, such as name, email address, telephone number, etc. 6. The payment information table-used to record all payment methods such as credit card, AliPay, Weixin Pay, etc. 7. The supplier information sheet-used to record the basic information of the supplier, such as company name, address, contact information, etc. The following is a simple online bookstore database design example. The product information table, order information table, and inventory information table already include some basic data fields: ``` --Item Information Form (Product) CREATE TABLE Product ( Product_ID INT PRIMARY KEY Product_Name VARCHAR(50) NOT NULL Product_Price DECIMAL(10 2) NOT NULL Product_Description TEXT NOT NULL Product_category VARCHAR(20) NOT NULL FOREIGN KEY (Product_ID) REFERENCES Product(ID) ); --Order Information Form (Order) CREATE TABLE Order ( Order_ID INT PRIMARY KEY Customer_Name VARCHAR(50) NOT NULL Order_Status VARCHAR(20) NOT NULL Order_Product VARCHAR(50) NOT NULL Order_Time TIMESTAMP NOT NULL FOREIGN KEY (Order_ID) REFERENCES Order(ID) ); --Storage Information Form (Stock) CREATE TABLE Stock ( Stock_ID INT PRIMARY KEY _ Arrival_Date Date NOT Empty <strong></strong><strong></strong> FOREIGN KEY (Stock_ID) REFERENCES Stock(ID) ); --Order Management CREATE TABLE Order Management ( Order_ID INT NOT NULL Order_'s status VarCHAR(20) NOT nil Order_'s method VARCHAR(20) NOT nil FOREIGN KEY (Order_ID) REFERENCES Order(ID) ); --Customer Information Form CREATE TABLE Customer ( Customer_ID INT NOT NULL Customer_Name VARCHAR(50) NOT NULL Customer_Email VARCHAR(100) NOT NULL Customer_Phone VARCHAR(20) NOT NULL FOREIGN KEY (Customer_ID) REFERENCES Customer(ID) ); --payment information form (Payment) CREATE TABLE Payment ( Payment_ID INT NOT NULL Payment_Name VARCHAR(50) NOT NULL Payment_Type VARCHAR(20) NOT NULL Payment_Time TIMESTAMP NOT NULL FOREIGN KEY (Payment_ID) REFERENCES Payment(ID) ); ``` In the above design, each table has a unique ID as the primary key to ensure the uniqueness and integrity of the data. At the same time, in order to support multi-currency transactions, the payment information table also included a payment type field to distinguish different payment methods.

In database design, how to store the content of the article?
1 answer
2024-09-22 00:05
In database design, the content of an article is usually stored as text data, which can be stored in a database or a non-database. The content of the article in...
Web Development: How to design the database for the article list?
1 answer
2024-09-23 00:32
There were a few aspects to consider when designing the article list database: 1. Table structure: You need to design a table to store the title, author, abstract, release time,...
Is the database simple or the network technology simple? Please, great gods
1 answer
2024-09-19 17:02
The computer science level three exam included two parts: database system and computer network technology. For database systems, the knowledge points were relatively scattered. It was relatively more complicated to...
The database design included two aspects. The reason? Thank you!
1 answer
2024-09-20 06:58
The design of a database usually includes two aspects: Relational design and Non-Relational design. 1. Relational design: Relational design is based on the design of tables. The data is organized...
What kind of books do you need to read for database design?
1 answer
2024-09-19 12:16
The field of database design involved computer science, data structure, database theory, programming languages, and many other fields. If you want to learn database design, you can refer to the...
What problems must be paid attention to during the database design process?
1 answer
2024-09-18 17:11
The following are some things that you must pay attention to during the database design process: Data integrity: When designing the database, you must ensure that all data is correct,...
Design a simple activity plan around the theme of "literature"
1 answer
2024-09-18 11:35
A simple activity plan could be designed around the theme of "literature", such as: Activity Name: Literature Reading Sharing Conference Activity purpose: Through the form of literary reading sharing sessions,...
How to design a database table with a large amount of data in java-based development? Please look at the stem
1 answer
2024-09-18 17:05
The following suggestions can be used to design a database table with a large amount of data in the development of Java: 1. Reasonably divide the table structure: divide the...
Experts, who knows where the detailed information and catalog information of each book in the online bookstore system are stored? The database is still text, xm...
1 answer
2024-09-22 00:04
The detailed information and catalog information of each book in the online bookstore system were usually stored in a text file. These text files were usually obtained by analyzing the...
Can you recommend some simple romance novels that focus on design?
1 answer
2024-09-09 08:17
šŸ˜‹Hello! Considering your needs, I'll recommend you a few novels about love and youth. 1. Are You A Hedgehog? Shu Ya: This is a healing love novel. Shu Ya and...
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z