Experience: e We have made customers come to Winmart to buy things to get information about invoices, as well as customer services, and participate in Winmart's membership program, Resea
Trang 1
DAI HQC QUOC GIA HA NOI
TRUONG QUOC TE VNU — INTERNATIONAL SCHOOL
REPORT SUBJECT: DATABASE SYSTEMS
TOPIC: WINMART'S MANAGEMENT SYSTEM DATABASE
GROUP 6
Member Name Student’s ID No Nguyễn Thị Sinh 22070627 Nguyễn Thị Thu Nga 22070629 Nguyễn Thị Hương Ly 22070378 Cao Đỗ Gia Khanh 22070771
Lecturers: Asso Prof Trần Thị Ngân Class: INS2080 - INS208001
Trang 2MEMBER’S CONTRIBUTION
Nguyễn Thị Sinh
Leader Write SQL Scripts
Design ERD, Relational Schema
Proofread and edit the report
25%
Nguyễn Thị Hương Ly
Insert real data into the SQL script
Gather information for the database
Write project report
Make presentation slides
25%
Nguyễn Thị Thu Nga
Case research
Design and give out some useful reports and information for real usage
Prepared chapter 1 of the report
Make presentation slides
25%
Cao Dé Gia Khanh
Case research Write project report
Design and give out some useful reports and information for real usage
Determine Entity Relationship
Conclude the project
25%
Trang 3
ow Final_Exam
™ Database Diagrams
= ™ Tables
™ System Tables
™ FileTables
™ External Tables
™ Graph Tables
EB dbo.Customers
EB dbo.Employees
E dbo.For_Membership
E dbo.INP_Products
E dbo.Inputs
E dbo.INV_Products
E dbo.Invoices
EB dbo.Products
E dbo.Promotional_Products
E dbo.Promotions
™ Views
™ External Resources
™ Synonyms
™ Programmability
™ Query Store
© Service Broker
™ Storage
™ Security
Trang 4TABLE OF CONTENTS
Chapter 1: INTRODUCTION "Ea eee aaeeeeeeeeeneaaeees 5
1.2 Requirement Specification na 5
PS 003000 0n e 5
Chapter 2: ANALYZING AND DESIGNING THE DATABASE LTnnneehhhhheee 7
PB =0 7
Chapter 3: SOME USEFUL REPORTS AND INFORMATION cài 12
Chapter 4: CONOGLUSION LH HH KH KH KH tệp 19
Bi Si>(-á06- 0 20
Trang 5Chapter 1: INTRODUCTION
1.1 About the organization
Winmart (formerly Vinmart) is a Vingroup grocery store system that was established on 20 Nov
2014 Vinmart was formally sold to Masan Group on December 3, 2019, and Masan has owned it ever since On 15 January 2022, WinMart and WinMart+ replaced VinMart and VinMart+ as their official names Winmart products include fresh food, household, cosmetic, and pre-processed food,
Instead of only investing in advertising and marketing campaigns, Winmart also invests in customer loyalty programs Customers who shop at Winmart can register to become a member of Win When becoming a member of Win, customers will have exclusive incentives and privileges The WIN Membership program has reached 4 million participants (as of early April 2023) In this report, we have chosen to collect information from Winmart's member customers 1.2 Requirement Specification
1 Method for collecting information
It is not difficult to find information related to Winmart's database system when we have a friend who used to work as a Winmart employee Our team did two types of investigations to find the data we used in this test
Interview:
e We took the time to connect with a friend who worked at Winmart to ask for information related to the supermarket's operating procedures such as warehousing, sales, etc., and information related to employees such as name, age, position Besides, we also asked about the working departments
Experience:
e We have made customers come to Winmart to buy things to get information about invoices,
as well as customer services, and participate in Winmart's membership program,
Research:
e We searched for some more product information on Winmart's website and followed Win's fanpage to update more incentives for both commercial customers and Winmart member customers
2 State the problem
Employee management:
Every supermarket needs an employee management system to store personal information and help organize work and tasks effectively, avoiding confusion
Import goods from suppliers:
When receiving goods from suppliers, warehouse staff are responsible for receiving goods and checking supplier information and the quantity of imported goods If information about goods is missing, employees need to make a list of information about those missing goods In case the
information is complete, the warehouse staff will prepare a receipt, and print and store the receipt
5
Trang 6Goods:
A supermarket will have a variety of goods, after warehousing and printing receipts, warehouse staff need to classify goods for easy control
Exporting goods from warehouse to counter:
When there is a request to load goods from the warehouse to the counter, the warehouse staff is responsible for checking whether the amount of goods in the warehouse meets the export needs
If the demand is met, the warehouse staff prepares an export ticket On the contrary, the warehouse staff notifies the manager to contact the supplier to place an order
Invoice:
When customers come to buy goods and request payment, the cashier will receive the customer's request and enter the barcode of the goods to proceed with invoicing, calculating money, printing invoices for customers, and storing In case the goods do not have a product code, or the product code is blurred, the cashier needs to report it to the manager for checking
Offers for customers:
A supermarket that wants to stabilize and retain customers should have a loyalty card for customers so that customers can receive incentives when making purchases or receive incentives
on holidays and birthdays
Daily revenue report:
After each shift, the cashier needs to check the money and end the shift In case the actual amount differs from the expected amount, the employee of that shift must report to the manager and supplement If not, the employee prints a shift handover slip The next shift staff checks the money again and opens the shift
Trang 7Chapter 2: ANALYZING AND DESIGNING THE DATABASE
ERD includes 10 entities with 3 weak entities and 9 relations
Trang 8
2.2 \dentify entities
1 Employees
Entities
ID
Name
1 Phone Num 1 Phone Number
Employees (Emp_ID, Emp_Name, DoB, Emp_Phone_Num, Position)
Primary key (Emp_ID)
ustomer ID ustomer Name
1
‘ust Num 10) ustomer Phone Number Address 3 *ustomer Address
Customers (Cust_ID, Cust_Name, Gender, Cust_Phone_Num, Cust_Address) Primary key (Cust_ID)
Code Code
Name Name
of Hand Units Units
Price MFG ing Date EXP iry Date
Products (Prod_Code, Prod_Name, Prod_QoH, Prod_Prod_Units, Prod_Price,
Prod_MFG, Prod_EXP)
Primary key (Prod_Code)
4 For_Membership
Điscount
For_Membership (Prod_Code, Prod_Price, Discount, Price_Member)
Foreign key Prod_Code references Products (Prod_code)
Trang 95
Invoices
INV_Date date Invoice Date
INV_ Code varchar(20) PK Invoice Code
Invoices (INV_Date, INV_Code, Cust_ID, Emp_ID)
Primary key (INV_ Code)
Foreign key Cust_ID references Customers (Cust_ID)
Foreign key Emp_ID references Employees (Emp_ID)
INV_Products
Code ice Code
Prod Code ÿ Product Code
Name Price Price Member b Member
INV int Invoice of Goods Total Total
INV_Products (INV_Code, Prod_Code, Prod_Name, Prod_Price, Price_Member, INV_QoG, INV_Total)
Foreign key INV_Code references Invoices (INV_Code)
Foreign key Prod_Code references Products (Prod_Code)
Inputs
Entities PK or FK
Date
Code int PK
ID FK ID
Inputs (INP_Date, INP_Code, INP_Supplier, INP_Qol, Emp_ID)
Primary key (INP_ Code)
Foreign key Emp_ID references Employees (Emp_ID)
INP_Products
Code i Code
Name Name
INP_Price Price
of Units Units
Total Total
INP_Products (INP_Code, INP_Name, INP_Price, INP_Qol, INP_Units, INP_Total)
Foreign key INP_Code references Inputs (INP_Code)
9
Trang 109 Promotions
Primary key (Prog_Code)
i PK
Start
End
ram,
10 Promotional_Products
Promotional_Products (Prog_Code, Prod_Code, Prod_Name, Price_Sale) Foreign key Prog_Code references Promotions (Prog_Code)
Foreign key Prod_Code references Products (Prod_Code)
2.3 Some real data and SQL scripts
Insert into
Values
( 09038539",
('09010818'
(° 09816324"
('89840912'
('99871197',
(*99030125'
(*99060497'
('09015873'
( 09066318" ,
( 09047932"
('99656941',
Tnsert into
Values
Emp loyees (Emp_ 1D ,Emp_ Name ,DoB, Gender ,Emp_Phone_ Num,Pos1tion)
“Le Vu Truong','9/27/1990', ‘Male’ , '0335080636', ‘Supermarket Director'),
, Le Ngoc Tho', '6/1/1982', 'Female', '9917211917', 'Staff'),
('99022894', “Nguyen Thanh Nam’, '5/3@/1995", ‘Male’, '@966243552", ‘Assistant Buyer’),
, Nguyen Thanh Nhan", '2/18/1984', 'Male', '9367346420", 'Manager'),
('99041319', "Nguyen Thanh Hung", 12/19/1991", 'Male', '9846556921', 'Warehouse Staff'),
, Nguyen Thi Bich Hanh', '9/12/1985', 'Femala' , '0988988030' , ‘Supervise Customer Service’),
‘Tran Trung Nhut','2/9/1998", 'Male' , '@706924373', 'Cashier'),
,'Vo Hoang Phuc’ ,'9/1/1998', 'Male' , '09788890211', ‘Customer Service Officer’),
, Duong Chi Hai','3/21/1991', 'Male' , '@908468067', 'Cashier'),
, Vo Hoang Bao Tram’, '5/20/1999", 'Female' , '9966339431'", 'Staff"),
» Tran Thi Kieu Diem" ,'3/8/1995",'Femele','0975395148', 'Cashier'),
‘Tran Minh Nhut','3/19/1995'", 'Male' , '@981137006', 'Manager'),
,'Bui Thi Đoan Tran", "8/6/1996", 'Fertale', "9822789162", Staff"),
'Vo Ngoc Tuyet", '9/30/1999", 'Female', '9932832024", '\wWarehouse Staff'),
‘Tran Thi Thanh Nhi", '2/22/1988', 'Female' , '9385982233', 'Iianager') ;
Customers (Cust_ID,Cust_Name, Gender, Cust_Phone_Num, Cust_Address)
(2346, 'Le Ki No’, ‘Male’ ,'9373106444" , ‘Ha Noi’),
(9754, 'Pham
(3423, 'Vo Thi Hong Thao', 'Female`', '9774000698', 'Ha No1"
(5847, 'Phan
Thi My Lien','Female', '9921092484', 'Ha Noi" ọ 3z
Minh Tri`', 'Male', `0768834774', 'Ha Noi"),
Thi Thanh Thao", 'Female' , '97086349967', 'Ha Noi'),
(6734, 'Nguyen Nhut Đien', 'Male', '9855660594','Ha Nol"'),
(7453, 'Nguyen Thi Thu Thao ','Female', '0783373227','Ha Noi'),
(8563, ‘Nguyen Manh Khang', ‘Male' ,'0939964723','Ha Noi‘),
(5628, ‘Pham
(9677, 'Tran
Thi Truc Linh’, ‘Female’, '@704925076','Ha Noi‘),
Thi Bao Tram’, ‘Female’ ,'0915511630','Ha Noi’),
(4968, ‘Thieu Thi Cam Tran’, ‘Female’, '@971045543', ‘Ha Noi‘),
(3843, ‘Tran Van Ca Lanh', ‘Male’ , '@939922133','Ha Noi‘);
10
Trang 11Values
(8935039508185, ‘AJI-NGON Hat nem goi 400g',256, ‘Pack’, '31,600','11/7/2023','5/7/2025"),
(8936019681415, 'CUNG DINH pho Ha Noi Huong vi bo 68g',465, ‘Pack’, '9,400° , '8/22/2023" ,'8/22/2024'),
(8936136168463, 'TPBS-NTL EnerZ Huong Xoai chanh day 320m1',460, 'Can', '14,009", '12/3/2023", '12/3/2024'),
(8936318653845, 'Dau dau nanh Simply chai 1 lit',564, 'Bottle', '52,908', '3/16/2023",'3/16/2025"),
(8935832465093, 'Tuong ot Chin Su chai 1kg',398, 'Bottle', '23,000°, '6/17/2023", '6/17/2024'),
(8936022577318, 'LTIFKUN Sua trai cay huong nho 18Øm1",350, 'Bottle', '29,Ø96', '12/9/2022`', '12/9/2024'),
(8936146441761, 'FEDDY - Da ca trung muoi cay 25g',288,'Pack ','20,000','9/24/2023','3/24/2024'),
(8936025690013, 'Nam kim cham 150g',5@, 'Pack','14,900", '11/23/2023','12/23/2023'),
(8936099691589, ‘Rau mam cai xanh WinEco 100g‘ ,70, ‘Pack’ ,‘18,500' ,'12/13/2023' ,'12/16/2023'),
(8935049501718, ‘Nuoc giai khat Coca Cola’,198,'Can',*9,300','10/20/2623' ,'10/20/2024'),
(8935049500254, ‘Nuoc tang luc Thums Up kiwi lon 320m]',281, 'Can', '9,890', '19/28/2923', '18/28/2024'),
(8935457808324, ‘Keo deo Haribo Goldbears goi $0g',135,'Pack’,'27,508','10/15/2023','2/15/2025'),
(8936839964537, 'Tra len men STAR KOMBUCHA lon 25@m1',158,'Can','27,4@0','11/22/2@23" ,'11/25/2023'),
(8936175832708, 'Sua rua mat duong am Simple 150m1', 7Ø, 'Tube', '136, 996", '5/12/2023', '5/12/2026'),
(8937520375248, 'Bong tay trang Silcot Hop 82 mieng Nhat',100, 'Box', '41,7690', °7/11/2023', '7/11/2927'),
(8936852105094, ‘Bot banh xeo Meizan 400g',120, 'Pack", '29,009', '8/12/2023", '8/12/2024'),
(8935634450369, 'Bot cacao STFood 100g' ,96, 'Pack", '44,408", '12/20/2023', "6/20/2024 ')
(8936359230546, 'Nuoc cot dua tuoi Vietcoco 169m1",98, 'Can ', "16, 360" , "11/12/2623", '11/12/2025"),
(8936438354900, 'Sua dac co duong Ngoi Sao Phuong Nam hop giay 389g (Xanh la)',87, 'Can', "19,768", "1/12/2223", '1/12/2824'3;
Insert into For_Membership(Prod_Code,Prod_Price,Discount , Price_Member )
Values
(8936099691589, '18,500' ,'20%','14,800'),
(8936146441761, '20,000' ,'15%','17,000'),
(8935049500254, '9,800','15%','8,330'),
(8937520375248, '41,700' ,'20%' ,'33,360'),
(8930175032708, '130,000' ,'10%','117,000'),
(8935634450309, '44,400° ,'7%','41,292"),
(8936025690013, '14,900' ,'10%' ,'13,410'),
(8935832465093, '43,000','15%','36,550'),
(8936010681415, '9,400' ,'20%','7,520'),
| (8935039508185, '31,600','10%' ,'28,440');
jInsert into Invoices(INV_Date, INV_Code,Cust_ID, Emp_ID)
Values
('12/13/2023" , '496701230904728' ,9754,°@9071197"),
('12/20/2023' , '496701240100089' , 2346, "@9060497"),
('12/7/2023' ,'334701231201973' ,7453, '8@9010818'),
(112/18/2023', '2A1601231291182)' , 3843, '09060497"),
(111/25/2023', '334701231293278)' , 3423, '09010818'),
(}110/28/2023", '4A1601239432914' ,5847, 09010818"),
('10/13/2023" , '496701230129471' ,6436,"09071197"),
(112/9/2923', '2A1601239234895' ,6734, '09010818'),
('11/7/2023' ,'334701231202738' ,8563,'@9071197'),
('8/22/2023' ,'4A1601230341447' ,5628, '89060497'),
Trang 12
Chapter 3: SOME USEFUL REPORTS AND INFORMATION
3.1 Design some useful reports and information for real usage
1 Find products with a total input price greater than 10,000,000 VND
2 Find out which supplier provided what item
3 Calculate the total invoice for each customer
4 Find the customer who buys the most items and calculate that customer's total invoice
5 Create a view showing customers who buy products in the promotion program
6 Create a view showing imported products and suppliers with an imported quantity of 70 or more
7 Create a procedure shows If:
Enter the correct code "Prod_Code", it will display information about the customer purchasing the
product
Enter code “1” to display all products
Entering the wrong code will display the wrong code value
8 Create a function to enter the position name to display the employee list
9 Find how many employees there are in total, how many female employees, and how many male employees
10 Create a Trigger to update the number of imported products on the "Inputs" table when adding import products to the "INP_Products" table
3.2 Solutions for the above reports/information
1 Find products with a total input price greater than 10,000,000 VND
Solution:
select * from INP_Products where INP_Total >10000000.00;
Output:
EB Results gil Messages
NP_Name INP_Price INP_Qol INP_Units INP_Total
1 AJI-NGON Hat nem goi 400g 460000.00 50 Carton of 12 packs 23000000.00
2 10618197 CUNG DINH pho Ha Noi Huong vi bo 68g 268000.00 50 Carton of 30 packs = 13400000.00
3 10010065 Dau dau nanh Simply chai 1 lit 500000.00 60 Carton of 12 bottles 30000000.00
4 10141747 = Tuong ot Chin Su chai 1kg 360000.00 70 Carton of 8 bottles 25200000.00
5 10197236 Tra len men STAR KOMBUCHA lon 250ml 34000000 40 Carton of 12 cans 13600000.00
6 10161716 Sua rua mat duong am Simple 150ml 95000.00 150 Tube 14250000.00
7 10020890 Bong tay trang Silcot Hop 82 mieng Nhat 1000000 35 Carton of 30 box 35000000.00
8 10326501 Bot banh xeo Meizan 400g 400000.00 30 Carton of 24 packs 12000000.00
9 10142178 Nuoc cot dua tuoi Vietcoco 160m! 350000.00 30 Carton of 24 cans 10500000.00
10 10603574 Sua dac có duong Ngoi Sao Phuong Nam hop giay 380g (Xanh la) 40000000 60 Carton of 12 bottles 2400000000
2 Find out which supplier provided what item
Solution:
Select Inputs.INP_Code, Inputs INP_Supplier, INP_Products.INP_Name
From Inputs
Inner Join INP_Products on Inputs.INP_Code = INP_Products.INP_Code