VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY
UNIVERSITY OF ECONOMICS AND LAW
PROJECT REPORT
Subject: Databases
Subject name:
Market Online Management Project
Lecturers: Lam Hong Thanh
TP.HCM, Tháng 05 Năm 2021
MEMBERS OF GROUP
Number
Name
ID
Position
1
Phạm Gia Hoài An
K194060840
Leader
2
Trần Thị Diệu Ái
K194060842
Member
3
Trần Thị Hà Ly
K194060854
Member
4
Nguyễn Mạnh Quang
K194060865
Member
5
Nguyễn Thu Vân
K194060880
Member
TABLE OF CONTENTS
ABSTRACT ................................................................................................................... 4
CHAPTER I: OVERVIEW OF THE TOPIC ................................................................. 5
I. WHY CHOOSING THIS SUBJECT? ..................................................................... 5
II. PROJECT OBJECTIVES ....................................................................................... 5
III. EXPECTED RESULTS ........................................................................................ 6
IV. PRACTICAL SIGNIFICANCE ........................................................................... 6
1. For users ............................................................................................................ 6
2. For my team ...................................................................................................... 6
CHAPTER II: INTRODUCTION .................................................................................. 7
I. MODEL PARTICIPANT ........................................................................................ 7
II. GENERAL DESCRIPTION OF THE COMPANY .............................................. 7
III. GENERAL BUSINESS PROCESS ...................................................................... 7
1. Import process ................................................................................................... 7
2. Sales process ..................................................................................................... 8
IV. MAIN FUNCTION OF THE BUSINESS MODEL............................................. 8
1. Import process ................................................................................................... 8
2. Sales process ................................................................................................... 10
V. MAIN FUNCTION OF APP................................................................................ 12
CHAPTER III: ENTITY RELATIONSHIP DIAGRAM ............................................ 14
I. IDENTIFIES ENTITIES AND ATTRIBUTES .................................................... 14
II. RELATIONSHIP OF ENTITIES ......................................................................... 17
III. ENTITY RELATIONSHIP DIAGRAM (ERD) ................................................. 21
CHAPTER IV: LOGICAL DATABASE MODEL ..................................................... 23
CHAPTER V: PHYSICAL DATABASE MODEL ..................................................... 24
I. DATA TYPES ....................................................................................................... 24
II. DATABASE CREATION STATEMENT ........................................................... 35
1. Command to create database .......................................................................... 35
2. Create a foreign key ........................................................................................ 83
CHAPTER VI: SQL QUERY ...................................................................................... 85
ABSTRACT
The demand of manage information is highly in every organization. Management
information effectively help reduce cost, time and avoid redundancy data. To
understand deeply how benefit a database can bring to an organization and the process
to build a database, we decided to build a Market Online Management Project. With
the aim to help clinics easily in managing their business, take care of customers, … We
know within building this project, there will be mistakes that we can solve but it is the
chance for us to achieve knowledge and skills which are precious tools in the future and
we will make this project as good as we can.
CHAPTER I: OVERVIEW OF THE TOPIC
I. WHY CHOOSING THIS SUBJECT?
In the past, most of us would buy food mainly from wholesale markets, buying
agents in big centers or in markets and department stores. Today, the development of
the digital economy has changed the business perception of the whole society. It can be
seen that all products and services can be introduced and "sold" on the Internet.
Moreover, customers increasingly need to know information about the origin and origin
of agricultural products that ensure quality and safety for health or not? Therefore, in
addition to improving food quality, brand communication, and packaging improvement
to affirm quality reputation, managers need a more effective communication channel
and app design is the ultimate solution. selected best. Owning a sales app will help
businesses attract more potential customers through the internet. According to the latest
statistics, Vietnam currently has about 41 million internet users, accounting for about
45% of the country's population, most of which are young people with high shopping
needs. Moreover, nowadays, the online trend is developing day by day and is buying by
many users. About one third of the population uses the internet to search and look up
information about services and products. Therefore, when you have a sales app, your
business has attracted a number of customers on the internet. Without the app, you
would have lost an opportunity to sell and give that opportunity to competitors.
II. PROJECT OBJECTIVES
Promote sales activities anytime, anywhere. Customers will not have to come
directly to the store or purchase according to the store's operating hours but can buy at
any time. This helps to maximize sales opportunities, boost sales and facilitate
customers to shop, making them more satisfied.
Reduce business costs. Having a sales app will help save a lot of costs for store
rental, warehouse and human resource costs. In addition, having a sales app also makes
the payment of customers convenient and easier. Customers can pay via ATM cards,
through electronic payment methods.
Having a separate sales app for the business will also help improve the reputation
and brand value of the business. The face of a business on the internet is the app and
the colors, features and information on the app will fully reflect the image of the
business with the customer, contributing to affirm the company's brand value in the
hearts of the public.
III. EXPECTED RESULTS
Design database for the application of ordering products through the app.
Build management and business processes for the app model.
IV. PRACTICAL SIGNIFICANCE
1. For users
When the software was built, it became easier for the housewives to shop and
cook. Specifically, through each form of software including customer management,
food import and export management (export here means providing food to customers).
Thanks to that, the manager can comprehensively monitor the data and use it properly,
thereby helping the usage process and supporting decision making in the best way.
2. For my team
Understanding the process of building a database from idea creation, modeling,
data collection, storage and operation on SQL.
Designing a software based on the available data.
Project is the basis that my group can continue to develop in the following
subjects.
CHAPTER II: INTRODUCTION
I. MODEL PARTICIPANT
Suppliers
Customers
Shipping unit
Bank
Employee
II. GENERAL DESCRIPTION OF THE COMPANY
APP acts as an intermediary to help seller's products reach consumers
conveniently and quickly on the website. In order to provide clean food to consumers
quickly and conveniently, APP has main departments including Sales and Marketing,
and Accounting Division IT department and warehouse management department.
III. GENERAL BUSINESS PROCESS
1. Import process
Procedure
Describe
Step 1
Plan and contract with supplier
Step 2
Check the goods and compare
Step 3
Make an inventory receipt
Step 4
Completion of warehousing and payment
2. Sales process
Procedure
Describe
Step 1
Customer order
Step 2
Order process
Step 3
Payment process
Step 4
Delivery and processing of returned orders
IV. MAIN FUNCTION OF THE BUSINESS MODEL
1. Import process
- Plan and contract with supplier
Staff sends purchase request information to Seller including: real name, product,
quantity to be purchased, delivery schedule.
The import department contact with the Supplier and notify the plan to the
relevant to update information and sign a purchase contract. Then, the contract
information will be saved. And in the Contract database, each contract will be managed
with a contract code individual.
- Check the goods and compare
The warehouse department keeper relies on the purchase order or request form
to compare inventory information from the Warehouse database and at the same time
check their quality
- Make an inventory receipt
When the goods inspection is completed, all paperwork and receipt request will
be transferred to the accounting department to compare again before conducting the
transaction and printing the receipt.
Information about the goods entering the warehouse and the receipt will be saved
in the Warehouse database to manage imported products
- Completion of warehousing and payment
The department store keeper performs the stock storage operation and collates
with the sales information, then updates the information on the warehouse card. Finally,
payment is made to the provider. When the payment is successful, invoice information
will be recorded on the basis Corporate Purchase Invoice data.
2. Sales process
- Customers order
Customers through the information provided about the product and choose to
purchase through the application .
When ordering success, customer order information including order code,
customer code, Order date, product code and will be stored in the Order database to be
controlled.
- Order process
The system receives order information from the Order database, the company
checks orders and generates inventory information to prepare goods and shipping
Delivery Company.
Export slip information is stored in the Sales Voucher database
- Payment process
The accounting department transfers order information to issues invoices to
customers
- Delivery and processing of returned orders
The company will check the information and issue the same slip with row for the
Delivery company. The company receives the goods and carries out the communication
hang.
The delivery company receives and delivers the delivery. The delivery company
will confirm and send the bill of lading code and update the order status for the
company.
V. MAIN FUNCTION OF APP
Display information and images about the product: customers can feel the
authenticity through many angles of the product as well as reflect to customers partly
the product quality of the company.
For the product evaluation function: customers will have the reference to
decide whether to buy or not. At the same time, this function also helps the company to
manage quality 12 as well as its operation process effectively or not.
Display promotions and offers: to help customers have more opportunities to
access the company's products, especially for new products and outstanding products.
Not only that, promotion activities also aim to promote the product brand as well as the
company's reputation through consumer reviews.
Advanced product search and filtering function: Because the volume of
products is relatively large, customers often have the need to filter out a list of products
they want to buy, providing a better experience for users. trust and appreciate. instead
they have to be frustrated by wasting hours searching for the product they want.
Display related products: so that customers can refer more and increase the
ability to buy more products, an indispensable e-commerce app to display additional
products, reference products, products Other customers also buy …
Service experience: provides customers the option to add products to cart, create
a list of favorite products.
Show recipes : Not only provides clean, fresh and high quality ingredients, the
app also gives customers standard recipes to make family meals more delicious and
enjoyable. In addition to familiar Vietnamese dishes, the app also updates recipes from
famous chefs to get the richest menu for customers to choose from.
CHAPTER III: ENTITY RELATIONSHIP DIAGRAM
I. IDENTIFIES ENTITIES AND ATTRIBUTES
Entity
Supplier
Employee
.
Manager
Attribute
SupplierID
SupplierName
Address
PhoneNumber
Email
Product
EmployeeID
DepartmentID
Position
LastName
FirstName
Address
PhoneNumber
Email
HireDate
Salary
*Position:
Manager
EmployeeOnl
EmployeeOff
ManagerID
ManagerName
Key
attribute
SupplierI
D
Multivalued
Attribute
Address
PhoneNumbe
r
Email
Product
Employee Position
ID
DepartmentI
Departme D
ntID
Composite
Attribute
Address
Required
attribute
SupplierID
SupplierName
Address
PhoneNumber
Product
Address
EmployeeID
Position
LastName
FirstName
Address
PhoneNumber
Email
HireDate
Salary
ManagerI
D
ManagerID
ManagerName
EmployeeOnlID
ManagerID
Employee
OnlID
EmployeeOnlID
ManagerID
EmployeeOf EmployeeOffID
f
ManagerID
Employee
OffID
EmployeeOffID
ManagerID
Department
Departme
ntID
DepartmentID
DepartmentName
Employee
Onl
DepartmentID
DepartmentName
Contract
ContractID
ContractTime
SupplierID
SigningDate
QualityProductQu
antityProduct
ValueContract
ManagerID
Contract
Detail
ContractI
DContrac
tTime
SupplierI
D
QualityProdu
ct
ContractID
ContractTime
SupplierID
SigningDate
QuantityProduct
ValueContract
ManagerID
ContractID
ContractTime
LineNumber
ProductID
QuantityProduct
UnitPrice
VAT
TotalAmount
WarehouseL WarehouseID
ist
InventoryName
Location
ContractI
DContrac
tTime
LineNum
ber
InventoryLis WarehouseID
t
ProductID
QuantityProduct
Product
ProductID
ProductName
UnitPrice
ContractID
ProductI
D
WarehoueID
ProductID
QuantityProduct
ProductI
D
ProductID
ProductName
UnitPrice
Goods
Receipt
Note
ReceiptNoteIDRe
ceiptTime
SupplierID
EmployeeOffID
ReceiptN
oteID
ReceiptTi
me
SupplierI
D
ReceiptNoteID
ReceiptTime
SupplierID
EmployeeOffID
Goods
Receipt
Note
Detail
ReceiptNoteIDRe
ceiptNotTime
LineNumber
ProductID
QuantityProduct
ReceiptN
oteID
ReceiptN
otTime
ReceiptNoteID
ReceiptTime
LineNumber
ProductID
Warehous
eID
Location
ContractID
ContractTime
LineNumber
ProductID
Quantity
VAT
UnitPrice
TotalAmount
InventoryID
InventoryName
Location
UnitPrice
VAT
TotalAmount
WarehouseID
LineNum
ber
Quantity
UnitPrice
VAT
TotalAmount
WarehouseID
Customer
CustomerID
CustomerNameA
ddress
PhoneNumber
Account
PassWord
Customer
ID
Order
OrderID
OrderTime
CustomerID
OrderID
OrderTim
e
OrderID
CustomerID
OrderTime
Order
Detail
OrderID
OrderTime
LineNumber
CustomerID
ProductID
QuantityProduct
OrderID
OrderTim
eLineNu
mber
OrderID
OrderTime
LineNumber
CustomerID
ProductID
QuantityProduct
Goods
Delivery
Note
DeliveryNoteID
DeliveryTime
OrderID
CompanyDeID
Delivery
NoteID
DeliveryT
ime
DeliveryNoteIDDe
liveryTime
OrderID
CompanyDeID
Goods
Delivery
Note
Detail
DeliveryNoteID
DeliveryTimeTim
e
LineNumber
QuantityProduct
UnitPrice
TotalAmount
ProductID
Delivery
NoteID
DeliveryT
imeTime
LineNum
ber
DeliveryNoteIDDe
liveryTimeTime
LineNumber
Quantity
UnitPrice
TotalAmount
ProductID
Invoice
InvoiceID
InvoiceTime
OrderID
CustomerID
InvoiceID
InvoiceTi
me
InvoiceID
InvoiceTime
OrderID
CustomerID
Address
Address
CustomerID
CustomerName
Address
PhoneNumber
Account
PassWord
Invoice
Detail
InvoiceID
InvoiceTime
LineNumber
ProductID
QuantityProduct
UnitPrice
TotalAmount
InvoiceID
InvoiceTi
me
LineNum
ber
Delivery
Company
CompanyID
CompanyNam
Address
Email
PhoneNumber
Company
ID
Delivery
Status
DeliveryID
DeliveryTime
Status
CompanyID
ReturnNoteID
ReturnTime
DeliveryNoteID
CustomerID
DeliveryI
D
ReturnNoteID
ReturnTime
LineNumber
DeliveryNoteID
ProductID
QuantityProduct
UnitPrice
Reason
Refund
WarehouseID
ReturnNo
teID
ReturnTi
me
LineNum
ber
Returned
Goods
Receipt
Note
Returned
Goods
Receipt
Note
Detail
InvoiceID
InvoiceTime
LineNumber
ProductID
Quantity
UnitPrice
TotalAmount
Address
CompanyID
CompanyName
Address
Email
PhoneNumber
DeliveryID
DeliveryTime
Status
CompanyID
ReturnNoteID
ReturnTime
DeliveryNoteIDCu
stomerID
ReturnNo
teID
ReturnTi
me
ReturnNoteID
ReturnTime
LineNumber
ProductID
QuantityProductUn
itPrice
Reason
Refund
WarehouseID
II. RELATIONSHIP OF ENTITIES
Name
Relationship
Cardinality
Relationship
Description
R1
Supplier – Contract
One supplier has zero or more
1-n
contract.
One contract has only 1 supplier
R2
Contract – ContractDetail
A contract has one or more
1-n
contract details.
A contract detail belongs to only
one contract.
R3
Supplier – GoodsReceiptNote
A supplier has one or more goods
1-n
received notes.
A goods received note has only
one supplier.
R4
GoodsReceiptNote – Goods
Receipt Note Detail
A goods received notes has one or
1-n
more goods received notes details.
A goods received notes detail
belongs only to one goods
received note.
R5
Department – Employee
A department has one or more
1-n
employees.
An employee is part of only one
department.
R6
Manager – EmployeeOnl
One manager manages one or
1-n
more online employees.
An online employee is managed
by one manager.
R7
Manager – EmployeeOff
One manager manages one or
1-n
more offline employees.
An offline employee is managed
by one manager.
R8
EmployeeOff – GoodsReceipt
Note
An employee creates zero or more
1-n
goods received notes.
A goods received note is
generated by one employee.
R9
WarehouseList – Goods
ReceiptNoteDetail
A warehouse list has one or more
1-n
goods received note details.
A goods received note detail
belongs only to one warehouse
list.
R10
ContractDetail – Product
A contract detail has one or more
1-n
product.
A product belongs only to one
contract detail.
R11
InventoryList – Warehouse List
An inventory list has one or more
1-n
warehouse lists.
A warehouse list belongs to only
one inventory list.
R12
InventoryList – Product
1-n
An inventory list has zero or more
products.
A product belongs to only one
inventory list.
R13
Customer – Order
A customer has zero or more
1-n
orders.
An order belongs to only one
customer.
R14
Order – OrderDetail
An order has one or more order
1-n
details.
An order detail is part of a single
order.
R15
Order - Invoice
One order has one invoice.
1-1
R16
Invoice – InvoiceDetail
A invoice is part of an order.
A invoice has one or more invoice
1-n
details.
A invoice detail belongs to only
one invoice.
R17
InvoiceDetail – Goods
DeliveryNoteDetail
A invoice detail with zero or one
1-1
goods delivery detail.
A goods delivery detail belongs to
only one invoice detail.
R18
GoodsDeliveryNote – Goods
DeliveryNoteDetail
A goods delivery note has one or
1-n
more goods delivery note details.
A goods delivery note detail only
belongs to one goods delivery
note.
R19
DeliveryCompany – Goods
DeliveryNote
A delivery company has one or
1-n
more goods delivery notes.
A goods delivery note belongs to
only one company delivery.
R20
DeliveryCompany – Delivery
Status
A delivery company has one or
1-n
more delivery status.
A delivery status belong to
delivery company.
R21
Customer – Invoice
A customer has zero or more
1-n
invoice.
A invoice belongs to only one
customer.
R22
GoodsDeliveryNote – Returned
GoodsReceivedNote
A goods delivery note has zero or
1-1
one returned goods received note.
A returned goods received note
belongs to only one goods
delivery note.
R23
ReturnedGoods ReceivedNote –
A returned goods received note
ReturnedGoodsReceived
has one or more returned goods
NoteDetail
1-n
received note details.
A returned goods received note
detail belongs to only one
returned goods received note.
R24
InventoryList – Returned
GoodsReceivedNoteDetail
A inventory list has one or more
1-n
returned goods received note
details.
A returned goods received note
detail belongs to only one
inventory list.
III. ENTITY RELATIONSHIP DIAGRAM (ERD)
CHAPTER IV: LOGICAL DATABASE MODEL
CHAPTER V: PHYSICAL DATABASE MODEL
I. DATA TYPES
Table 1: Supplier
Attribute
Key
Data type
Length
SupplierID
PK
Char
8
SupplierName
nvarchar
255
Address
nvarchar
255
PhoneNumber
varchar
11
Email
varchar
30
Product
nvarchar
255
Allow null
X
Table 2: Employee
Attribute
Key
Data type
Length
EmployeeID
PK
char
8
DepartmentID
FK
char
3
Job
nvarchar
30
LastName
nvarchar
10
Allow null
X
FirstName
nvarchar
255
Address
nvarchar
255
PhoneNumber
nvarchar
11
Email
nvarchar
30
Salary
numeric
10, 2
Table 2a: Manager
Attribute
Key
Data type
Length
ManagerID
PK
char
8
nvarchar
255
ManagerName
Allow null
X
Table 2b: EmployeeOnl
Attribute
Key
Data type
Length
EmployeeOnlI
PK
char
8
char
8
Allow null
D
ManagerID
Table 2c: EmployeeOff
Attribute
Key
Data type
Length
Allow null