Phân tích hệ thống CSDL Quản Lý Khách Sạn - Khóa học SQL Server
Liệt kê được các đối tượng cần quản lý
- Roles: Quản lý role người dùng
- id: int -> primary key -> identity(1,1)
- rolename: nvarchar(50) not null
- User: Quản lý được nhân viên
- id: int -> primary key -> identity(1,1)
- fullname: nvarchar(50)
- birthday: date
- gender: nvarchar(20)
- email: nvarchar(150)
- phone_number: nvarchar(20)
- address: nvarchar(200)
- id_role: int -> references Role (id)
- Room: Quản lý phòng
- id: int -> primary key -> identity(1,1)
- room_no: nvarchar(20)
- type: nvarchar(20)
- max_num: int
- price: float (Quy dinh theo ngay/gio/...)
- Quản lý đặt phòng: 1 người thuê được nhiều phòng, mỗi phòng lưu được danh sách người thuê
- Booking:
- id: int -> primary key -> identity(1,1)
- staff_id: int -> references User (id)
- customer_id: int -> references User (id)
- checkin: datetime
- checkout: datetime
- status: int -> 0 (pending -> confirm|cancel -> checkedin -> checkedout -> done)
- note: ~~~
- BookingDetail:
- booking_id: int -> references Booking (id)
- room_id: int -> references Room (id)
- price: float
- unit: float
- primary key (booking_id, room_id)
- UserDetail:
- booking_id: int -> references Booking (id)
- room_id: int -> references Room (id)
- customer_id: int -> references User (id)
- primary key (booking_id, room_id, customer_id)
- Category: Quản lý danh mục dịch vu
- id: int -> primary key -> identity(1,1)
- name: nvarchar(50)
- Product: Quản lý dịch vụ (đồ uống, dịch vụ khác bể bởi, massage, tennis, .v.v)
- id: int -> primary key -> identity(1,1)
- category_id: int -> references Category (id)
- title: nvarchar(150)
- thumbnail: nvarchar(500)
- description: ntext
- price: float
- amount: int
- Quản lý sử dụng dịch vụ
- Người/Tổ chức -> Thuê phòng -> thuê nhiều phòng -> mỗi phòng gồm nhiều người -> mỗi người họ sẽ sử dụng 1 dịch vụ khác nhau
Mong muốn: ai đã sử dụng đồ uống, đồ uống gì, giá tiền, số lượng, thời điểm mua -> Gắn bới đặt phòng nào
Services:
- id: int -> primary key -> identity(1,1)
- customer_id: int -> references User (id)
- product_id: int -> references Product (id)
- amount: int
- price: float
- buy_date: datetime
- booking_id: int -> references Booking (id)
================================= HOÀN THÀNH QUÁ TRÌNH PHÂN TÍCH CSDL =====================================
-- Tao CSDL
create database BT2781
go
-- Kich hoat CSDL
use BT2781
go
-- Tao Tables
create table Roles (
id int primary key identity(1,1),
rolename nvarchar(50)
)
go
create table Users (
id int primary key identity(1,1),
fullname nvarchar(50),
birthday date,
gender nvarchar(20),
email nvarchar(150),
phone_number nvarchar(20),
address nvarchar(200),
role_id int references Roles (id)
)
go
create table Room (
id int primary key identity(1,1),
room_no nvarchar(20) not null,
type nvarchar(20),
max_num int,
price float
)
go
create table Booking (
id int primary key identity(1,1),
staff_id int references Users (id),
customer_id int references Users (id),
checkin datetime,
checkout datetime
)
go
create table BookingDetail (
booking_id int references Booking (id),
room_id int references Room (id),
price float,
unit float,
primary key (booking_id, room_id)
)
go
create table UserDetail (
booking_id int references Booking (id),
room_id int references Room (id),
customer_id int references Users (id),
primary key (booking_id, room_id, customer_id)
)
create table Category (
id int primary key identity(1,1),
name nvarchar(50)
)
go
create table Product (
id int primary key identity(1,1),
category_id int references Category (id),
title nvarchar(150),
thumbnail nvarchar(500),
description ntext,
price float,
amount int
)
go
create table Services (
id int primary key identity(1,1),
booking_id int references Booking (id),
customer_id int references Users (id),
product_id int references Product (id),
price float,
amount int,
buy_date datetime
)
go
Ứng Dụng Học
Theo dõi cập nhật nội dung học trên Youtube & Facebook
Thông Tin Liên Hệ
Công Ty Cổ Phần Công nghệ ZicZac Việt Nam.
Website: https://ziczacvn.com
SĐT: 096 - 70 25 996
Email: ziczacgroup@gmail.com
Thiết kế webiste chuyên nghiệp
Thiết kế phần mềm quản trị
Thiết kế ứng dụng Android
Thiết kế ứng dụng IOS
Thiết kế Web App
Hỗ trợ Digital Marketing
Hỗ trợ quảng cáo Google Ads
Hỗ trợ quảng cáo Facebook Ads
Hỗ trợ SEO Website