I.
Problem statement
- System name : VinFast car sales management system.
- Objective : Build a database system to manage VinFast car sales, including managing
information on car models, colors, cars in stock, customers, employees, orders and payment
transactions. The system needs to support operations such as adding new cars, creating orders,
processing transactions, and generating revenue/profit reports.
- Scope : The system focuses on the vehicle sales process, from entering the vehicle into the
warehouse, selling the vehicle to the customer, to tracking payments. Does not include warranty
management, after-sales service, or suppliers (can be expanded if needed).
- Input data : Car model information, color, car, customer, employee, order, transaction (based
on simulated data or from a small car sales website like vinfastauto.com).
- Desired output :
+ Manage vehicle data and orders effectively.
+ Report on revenue, profit, and sales trends.
+ Ensure data integrity through constraints and triggers.
II. Description of system operations
The system includes the following operations:
1. Vehicle model management (ProductModels) :
- Add, update, delete car models.
- Look up and count the number of vehicles by model.
2. Color management (Colors ) :
Add, update, delete colors.
3. Vehicle management (Products) :
- Import new vehicles, update vehicle information, delete vehicles.
- Look up vehicles in stock, check sold vehicles, and make statistics by status.
4. Customer Management :
- Add, update, delete customers.
- Search and view purchase history.
5. Employee Management :
- Add, update, delete employees.
- Look up and view performance.
6. Order Management :
- Create, update, cancel orders.
- Look up and apply discounts automatically.
7. Transaction management (Transactions ) :
- Create, update, cancel transactions.
- Transaction lookup.
8. Reporting and analysis :
- Revenue report by employee, vehicle model.
- Report on orders, transactions, profits, sales trends
II. ERD model of the system
III. Relational model
V. Data requirement specification
Composition or
Data Element Description Length Values
Data Type
Vehicle model Character string, for
ModelID VARCHAR 10
identification code example: "VF3", "VF5"
Unicode string, for example:
ModelName Model name NVARCHAR 50
"VinFast VF3"
A character string, for
ColorID Color identifier VARCHAR 10
example: "COL001"
Unicode string, for example:
ColorName Color Name NVARCHAR 20
"Gold"
Vehicle
ProductID INT Integers increase by 1
identification code
Real number, for example:
PurchasePrice Car import price DECIMAL(18,2)
249000000.00
Real number, for example:
SalePrice Car price DECIMAL(18,2)
299000000.00
Unique character string, for
ChassisNumber Chassis number VARCHAR 20
example: "VF31234567890"
Customer A character string, for
CustomerID VARCHAR 10
identification code example: "CUST001"
Customer/employee Unicode string, for example:
FullName NVARCHAR 50
name "Nguyen Van A"
String of numbers, for
Phone Phone number VARCHAR 15
example: "0901234567"
12 digits, for example:
ID Number ID card number VARCHAR 12
"123456789012"
A character string, for
OrderID Order ID VARCHAR 10
example: "ORD001"
Number of vehicles
Quantity INT Integer > 0, for example: 1
in order
Real number, for example:
TotalAmount Total order amount DECIMAL(15,2)
299000000.00
Transaction A character string, for
TransactionID VARCHAR 10
identifier example: "TRANS001"
Unicode string, e.g.
PaymentMethod Payment method NVARCHAR 50
"Transfer"
VI . List of data constraints
1. Primary Key (PK) Constraint : Each table has a unique primary key (ModelID, ColorID,
ProductID, CustomerID, EmployeeID, OrderID, TransactionID) .
2. Foreign key (FK) constraint :
Products.ModelID → ProductModels.ModelID
Products.ColorID → Colors.ColorID
Orders.CustomerID → Customers.CustomerID
Orders.ProductID → Products.ProductID
Orders.EmployeeID → Employees.EmployeeID
Transactions.OrderID → Orders.OrderID
Transactions.EmployeeID → Employees.EmployeeID
Unique constraint :
Products.ChassisNumber , Products.EngineNumber , Customers.IDNumber
Value binding :
Orders.Quantity > 0
Orders.Discount between 0 and 100
Customers.IDNumber must be 12 digits
Business constraints (using triggers):
Vehicle must be in "In Stock" status when order is created.
Staff must be "Active" when processing orders/transactions.
The transaction amount must match the total order amount.
List of data bindings
Physical installation
Create table with constraints, insert data. Set Index if any.
SQL queries and corresponding answers
Triggers for setting complex constraints
Procedures and functions to solve business problems
File script.sql
Conclude
Results achieved : VinFast car sales management system has been fully designed and
installed with ER model, relational model, data dictionary, and constraints. Main operations such
as car management, orders, transactions, and reports have been implemented through tables,
triggers, and procedures.
Limitations : Does not include detailed inventory management, warranty, or suppliers. Can be
expanded if needed.
Recommendation : Integrate user interface or add advanced reports (e.g. regional analysis).