1. Trang chủ
  2. » Luận Văn - Báo Cáo

subject databases report final exam coffee shop management system

16 0 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

Trang 1

VIETNAM NATIONAL UNIVERSITY, HANOI INTERNATIONAL SCHOOL

Subject: DATABASES REPORT FINAL EXAM

Nguyen Anh Tu — 20070998 Dang Thi Hien — 20070927 Doan Minh Hieu — 21070813

Hanoi, 12" December, 2022

Trang 2

MEMBERS’ CONTRIBUTION

2 Dang Thi Hien 20070927

3 Doan Minh Hieu 21070813

4 Le Thi Huyen Trang 20070992

Trang 3

TABLE OF CONTENTS

CHAPTER 1: INTRODUCTION uu ccssccsscssscsecscecserssesseersenecencetsensccnsenecesessensecacencertsenceecenecenace 6

1, Abouf the (QPQGHỈ2GfÍOH, TH ch nh gà” 6 2 Ñ€QHITCHICHÍ SDGCÍÍÏCŒÍ[OH, HH ĐH ĐT ĐT Hoá ngà 6 2.1 Methods for investigating business rules -. - - -< «=5 =2 *>

3 Some reql dadfq qHd SỢT sCFIDES - on kg nh nh ve

1 Đesigrn some usefMI reporfs qnd tƒ0rmufion 0F redl Hsdg 10

3 Soluffoms for the abOV€ F€DOFÍS HH HT HH nọ hp 15

Trang 4

ABSTRACT

Coffee is a drink of people who go to work, and office people, but recently coffee is also loved by young people Besides, the demand for people is increasing compared to the business of opening more coffee shops This report is investigating the direct sales system of The Coffee House at 47 Nguyen Tuan, Thanh Xuan District, Hanoi

Opening a coffee shop needs many factors: finance, facilities, and favorable geography for business development Besides, how to manage your cafe is also a big question to be solved So how to quickly manage and save a significant amount of time? Therefore, our group has researched and designed a database system for The Coffee House cafe based on the knowledge we have gained when researching this topic

The database system will support the management of transactions such as product orders, customer invoices, and information customers Maintained databases typically containing order details, product details, and employee information We use SQL Server to connect to the database and perform various operations This will help the system management of The Coffee House become more optimal, the management easier and more convenient.

Trang 5

CHAPTER 1: INTRODUCTION

1 About the Organization

With the “invasion” of many famous international coffee brands, the Vietnamese startup

brand has only appeared in the past few years but has achieved great results in business, which is the coffee chain The coffee House - the dream "Coffee house" in the heart of the city

Vietnam Tea Coffee Service Trading Joint Stock Company - also known as The Coffee House is a Vietnamese coffee brand chain formed in 2014 by Nguyen Hai Ninh (currently the Vice President of the company) ) The Coffee House is aimed at young customers who prefer a luxurious space to work and play at a mid-range price (30 000 — 60 000 VND) Currently, The Coffee House has appeared in many big cities across the three regions such as Ho Chi Minh, Hanoi, and Da Nang, along with about 160 stores, serving more than 40,000 customers per day Becoming the leading coffee brand chain in Vietnam and reaching out to the world Combining traditional and modern design, creating the unique essence of The Coffee House

The Coffee House will be the convergence of coffee lovers and enthusiasts The Coffee House along with its mission that when working with all sincerity and respecting the original values of each employee as well as the customer, everyone will receive joy small, get better and make others better day by day

through social networking sites Besides, The Coffee House has launched its own mobile

application, bringing interesting technology experiences to users b Observation

The coffee house is a brand favored by young people and we are its customers, so it is easy to access information about The Coffee House through store management and draw the following conclusions:

« Simplify the bookkeeping information by storing it in the computer system

* Help to manage the system of the restaurant more optimally, the management is easy and convenient

Trang 6

- Products order: Based on The Coffee House's menu, guests will order products according to their needs and record them by the cashier on the Order_Detail

Process 2: Payment

Create invoices: The cashier will create an Invoice based on the actual quantity that the guests have ordered in the Order_Detail and collect the exact amount that they have to pay

There are two options for payment: Cash / Credit Card

Guest can choose between two options for ways for the cashier to draft the Invoice

- Customers will receive invoices

— Finish the payment and receive products

In order to maintain track of staff working with invoices, each person's information will be kept

on the system is Staff: which includes Staff ID, Staff name, Staff phone

CHAPTER 2: Analyzing and Designing the Databases

F—— ‹ oe )

Customer

J aS es =

— À— =7 _L < ProductiD )

Trang 7

Customer (ID, FullName, Gender, Birthday, PhoneNumber) PRIMARY KEY(D)

Orders (ID, CustomerID, StaffID, PriceTotal, OrderDate) PRIMARY KEY(D)

FOREIGN KEY (CustomerID) REFERENCES Customer(ID)

FOREIGN KEY (StaffID) REFERENCES Staff(D) OrderDetail (ID, OrderID, ProductID, Price, Num, PriceTotal)

Trang 8

ID int primary key identity(1,1), Name nvarchar(5@) not null )

Go

Here is some sql script data of Product table

=\Create table Product(

ID int primary key identity(1,1), Title nvarchar(5@) not null, Price float,

Category_ID int references Category(ID) )

(‘Oolong Tea’ ,'45000','2') (‘Matcha Freeze’ ,'55000','3'), (‘Chocolate Freeze’, '55000','3'), (‘Caramel Freeze’ ,'55000','3'), (‘Coffee Freeze’ ,'55000','3'), (‘Apple Juice’ ,'40000",'4'), (‘Orange Juice’, '40000','4'), (‘Watermelon Juice’, *40000','4'), (‘Guava Juice’ ,'40000','4'), (‘Strawberry Smoothie’ ,'55000",'5'), (‘Blueberry Smoothie’ ,'55000','5'), (‘Mango Smoothie’ ,"55000",'5"), | (‘Apple Smoothie’ ,'55000",'5")

Go

Here is some sql script data of Staff table

Trang 9

ID int primary key identity(1,1), FullName nvarchar(5@) not null, Address nvarchar(2090), Gender nvarchar(20), Birthday date, PhoneNumber nvarchar(2@) )

Go

=Insert into Staff(FullName,Gender ,Birthday,PhoneNumber, Address) Values (‘Le Ha Nam', ‘Male’, 2000/12/30" , '@392433993",'Ha Noi’),

(‘Ho Tu Tai’, ‘Male’ ,'2002/12/09' ,'@34922899','Ha Nam'), (‘Ngo Thu Huong", ‘Female’ ,' 2002/09/24" ,'@816788344','Lao Cai'), (‘Do Hai Nam', ‘Male’ ,' 2000/03/12", '0914789345','Ha Noi‘), (‘Phi Phuong Anh", ‘Female’ ,'2001/11/03' ,'@379147896', ‘Hai Phong’),

(‘Hoang Hai Nam', 'Male' , '2991/03/29', '9372467957', "Ha Noi"),

('Bui Thi Ha', 'Female' , '2992/06/03', '0392433879', 'Ha Noi"),

('Ngo Thu Hue', 'Female" , '2992/09/22',, '9816788346', 'Lao Cai"),

(‘Phi Phuong An", 'Female`' , "2901/11/13", '9379147891', 'Hai Phong") GO

Here is some sql script data of Customer table

=Create table Customer ( ID int primary key identity(1,1), FullName nvarchar(5@) not null, Gender nvarchar(2@), Birthday date, PhoneNumber nvarchar(20) )

Trang 10

(‘Ngo Huy Hoang", ‘Male' ,'1998/07/16' , '0369773476'),

('Ta Huy Anh" , ‘Male’ ,' 2000/10/12" ,'@915289765'),

(‘Ly Binh", ‘Male’ ,'1990/05/27' ,'0816788377'), (‘Nguyen Hoai An', ‘Female’ ,' 2000/10/12" ,'@987652345'),

(‘Ha Anh Tu’, ‘Female’ ,' 2000/11/23" ,'@813987267'),

(‘Le Ngoc Quynh", ‘Female’ ,' 2000/11/12" ,'0384726846'), ("Ho Huy Hoang", 'Male' ,'1999/0@3/12" ,'@983648652'),

(‘Bui Nam Dang’, ‘Male’, '1992/@9/21' , '@359228367'), (‘Ta Huy An', 'Male",'2001/10/12' , '0915289231'), (‘Le Mai Hoa’, Female’ ,'1996/01/20" , '@976752672'), (‘Tran Ly Bang’, ‘Male’ , "1995/05/20" , '@816788717' ) Go

Here is some sql script data of Orders table

=\Create table Orders(

ID int primary key identity(1,1), CustomerID int references Customer(ID), StaffID int references Staff(ID), PriceTotal float,

OrderDate datetime )

Go

=1Insert into Orders(CustomerID,StaffID,PriceTotal,OrderDate) Values (12,1,65000, '2022/12/01'),

(13,2,65000, '2022/12/01'), (14, 3,130000, '2022/12/02'), (15,4,65000, '2022/12/02'), (16,5, 130000, '2022/12/03'),

(18,7,45000, '2022/12/04'), (19,8,55000, '2022/12/02"), (20,9,55000, '2022/12/05"), (21,10, 45000, '2022/12/01"), (22,11,90000, '2022/12/03'), (23,12,90000, '2022/12/02'), (24,13 ,110000, '2022/12/01'),

Trang 11

ID int primary key identity(1,1), OrderID int references Orders(ID), ProductID int references Product(ID), Price float,

Num int, PriceTotal float, Go

=Insert into (17,2,65000, (18,3 ,65000, (19,3,65000, (20,2,65000, (21,2,65000, (22,4,45000, (23,5,45000, (24,8,55000, (25,9,55000, (26,7,45000, (27,6,45000, (28,7,45000, (29,9,55000, (30,2,65000,

OrderDetail(OrderID,ProductID,Price,Num,PriceTotal ,65000),

,65000), , 130000), ,65000), , 130000), ,45000), ,45000), , 55000), , 55000) , ,45000), , 90000), ; 90009), , 110000), ,65000), 1 1 2 1 2 1 1 1 1 1 2 2 2 1 (31,15,55000,1,55000 Go

CHAPTER 3: INFORMATION

1 Design some useful reports and information for real usage

2 Based on the designed database for Highlands Coffee’s direct sales management, we

Values

SOME USEFUL REPORT AND

assign some questions to test the effectiveness of the system as well as List of 10 questions:

10 Calculate sales revenue per day

Create a view to getting customer phone number information Display product categories in an order

Find receipts for at least 2 different products Total bill number 23

Top 3 customers who buy the most products

List of customers who purchased goods on December 1, 2022

Trang 12

3 Solutions for the above reports/information 1 Show list information of all products

/*1 Show list information of all products*/ =select * from Product

2 Sort the product list descending by price

/*2 Sort the product list descending by price*/ =jselect * from Product

order by Price desc

& Results ei Messages

Trang 13

3, Display a list of drinks by category

/*3 Display a list of drinks by category*/

=)Select Category.Name ‘Category Name’, Product.Title ‘Product Name’, Product.Price

=Create proc Proc view product by category @categoryID int

as ~begin

from Category join Product on Category.ID=Product.Category_ID where category ID=-@categoryID

end

Exec Proc_view_product_by category 1

4, Create a view to getting customer phone number information

lia, Create a view to getting customer phone number information*/ =create view TTSDT

Trang 14

=select Orders.ID, staff.FullName 'Tên nhân viên', Customer.FullName 'rên khách hang’, Product.Title ‘Tén sản phẩm', Category.Name 'Danh mục sản phẩm', Orders.0rderDate, OrderDetail.Price, OrderDetail.Num,

OrderDetail.Price * OrderDetail.Num 'Téng tién' From Orders, Staff, Customer, OrderDetail, Product, Category where Customer.ID - Orders.CustomerID

and Staff.ID -0rders.StaffTD and_0rders 1D=0rderDetai].0rder1D and _OrderDetail.ProductTD-Product 1D

Go

/*5 Display product categories in an order*/

=Select Orders.ID, Staff.FullName ‘Tén nhân viên', Customer.FullName 'ïên khách hàng', Product.Title ‘Tén sản pham', Category.Name 'Danh mục sản phấm', Orders.OrderDate, OrderDetail.Price, OrderDetail.Num,

OrderDetail.Price * OrderDetail.Num ‘Tong tiền” From Orders, Staff, Customer, OrderDetail, Product, Category Where Customer.ID = Orders.CustomerID

and staff.ID =0rders.Staff1D and Orders.T1D-0rderDetaiÌ OrderID and _OrderDetail.ProductTD-Product 1D and Product.Category_T1D-Category 1D 6o

6 Find receipts for at least 2 different products

/*6 Find receipts for at least 2 different products*/ =|Select * from Orders

where ID in ( Select ID from OrderDetail where Num >=2) EB Results gl Messages

ID- CustomerID StafflD PriceTotal OrderDate

=\declare @tong float

exec Tonghoadon 23,@tong output print @tong

el Messages 45000

Trang 15

=select top(3) Fullname, Phonenumber,, count (Product1D)

from Customer c inner join Orders o on o.CustomerID-c.ID inner join OrderDetail od on od.OrderID-o.ID group by FullName,PhoneNumber

order by count(ProductID) desc EE Results z8 Messages

9 List of customers who purchased goods on December 1, 2022

=Select C.ID, Fullname

from Customer C inner join Orders 0 on C.ID=0.CustomerID

where OrderDate ='2022/12/01° Go

EE Results z8 Messages ID Fullname

10 Calculate sales revenue per day

/*10 Calculate sales revenue per day */ =Select OrderDate, Sum(PriceTotal) as DOANHTHU

from Orders group by OrderDate

Trang 16

CHAPTER 4: CONCLUSION

The role of this database system is to help businesses store data and information consistently and minimize redundancy through certain categories By setting up a database system, workers will be able to quickly find information about objects (quantity, price, supplier ) It also helps to research and define customer preferences for in-store products (coffee, tea, iced coffee, etc.) and implement appropriate promotions in time to increase sales

However, this approach is not without errors and can result in large amounts of data being wrong

REFERENCES

Ngày đăng: 22/07/2024, 17:45