Mysql数据分析1_酒店预定需求分析

MySQL数据分析1_酒店预定需求分析

本文所有数据来源于kaggle:Hotel booking demand
使用工具:MySQL,Excel

1.背景

您是否想过一年中什么时候预定酒店房间?还是为了获得最佳每日房价而获得的最佳停留时间?如果您想预测酒店是否可能收到过多的特殊要求,该怎么办?该酒店预订数据集可以帮助您探索这些问题!

2.提出问题

1)酒店运营分析(城市酒店和假日酒店预订需求和入住率比较、客流量趋势、渠道等角度)
2)用户分析(预定时长、入住时长、预定餐饮、特殊要求、用户类型等)
3)顾客一年中最佳预定酒店时间是什么时候?
4)酒店该怎样增加收入?

3.数据理解

字段截图
数据截图
以上两张图片是字段和部分数据截图,原始数据共32个字段,每个字段119390行
对每个字段理解如下:

字段 解释
hotel Hotel(H1 = Resort Hotel or H2 = City Hotel)
is_canceled 是否取消预定(取消(1),不取消(0))
lead_time 预定时长(从预定到入住的时间)
arrival_date_year 到达时间(年)
arrival_date_month 到达时间(月)
arrival_date_day_of_month 到达时间(日)
arrival_date_week_number 到达时间(在当年为第几周)
stays_in_weekend_nights 在周末的入住天数
stays_in_week_nights 在工作日的入住天数
adults 入住成人数
children 入住儿童数
babies 入住婴儿数
meal 预定餐饮类型(Undefined/SC – no meal package; BB – Bed & Breakfast; HB – Half board (breakfast and one other meal – usually dinner; FB – Full board (breakfast, lunch and dinner))
market_segment 细分市场( “TA” means “Travel Agents” and “TO” means “Tour Operators”)
distribution_channel 分销渠道
is_repeated_guest 是否为老客(是(1),否(0))
previous_cancellations 客户在当前预订之前取消的先前预订数
previous_bookings_not_canceled 客户在当前预订之前未取消的先前预订数
reserved_room_type 预定房间类型
assigned_room_type (酒店)安排的入住房间类型(房型可能会受时间等因素有所调整)
deposit_type 押金类型
agent 预定的旅行社ID
company 预定的公司ID
days_in_waiting_list 酒店方确认预定所需时长(从顾客下预定订单到酒店方确认订单所需时长)
customer_type 顾客类型(Contract - when the booking has an allotment or other type of contract associated to it; Group – when the booking is associated to a group; Transient – when the booking is not part of a group or contract, and is not associated to other transient booking; Transient-party – when the booking is transient, but is associated to at least other transient booking)
adr 日平均消费
required_car_parking_spaces 顾客要求提供的停车位数量
total_of_special_requests 顾客特殊需求的总数量
reservation_status 预定最终状态(Canceled – booking was canceled by the customer; Check-Out – customer has checked in but already departed; No-Show – customer did not check-in and did inform the hotel of the reason why)
reservation_status_date 预定最终状态确认时间

4.数据清洗

分为两个大方向,用户方向和酒店运营方向

用户方向

– 1.选择用户画像需要字段的子集,创建用户表。

CREATE table hotel_customer
    AS(SELECT hotel,lead_time,adults,children,babies,country,meal,stays_in_week_nights,stays_in_weekend_nights,booking_changes,customer_type,required_car_parking_spaces,total_of_special_requests
		FROM hotel_bookings)

– 2.清洗数据,检查数据完整性

SELECT count(hotel),count(lead_time),count(adults),count(children),count(babies),count(country),count(meal
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 功能需求分析 用户管理:添加用户,修改用户密码。 客户管理:添加客户,查询,修改,删除客户信息。 客房管理:添加客房,查询,修改,删除客房信息。 客房类型管理:添加客房类型,修改客房类型。 订房:预订客房,取消预订房间。 客房登记信息管理:查看客房登记信息。 2. 概念设计 用户实体ER图 客户信息实体ER图 客房信息实体ER图 客房类型ER图 登记记录ER图 总ER图 3. 逻辑结构设计 1. 客人信息表:tbclient "字段名 "数据类型 "空/非空 "约束条件 "其他说明 " "clientId "int "not null "IDENTITY(1"客户ID " " " " ",1) " " " " " "PRIMARY " " " " " "KEY " " "name "varchar(20)"not null " "客户姓名 " "sex "varchar(2) "not null " "性别 " "identityCar"varchar(30)"not null " "证件号 " "d " " " " " "phone "varchar(20)"not null " "联系电话 " 2. 登录信息表:tbemployee "字段名 "数据类型 "空/非空 "约束条件 "其他说明 " "employeeId "int "not null "IDENTITY(1"用户编号 " " " " ",1) " " " " " "PRIMARY " " " " " "KEY " " "userName "varchar(20)"not null " "用户名 " "password "varchar(20)"not null " "密码 " "per "int "not null " "权限 " 3. 房间类型表:tbtype "字段名 "数据类型 "空/非空 "约束条件 "其他说明 " "typeId "int "not null "IDENTITY(1"类型编号 " " " " ",1) " " " " " "PRIMARY " " " " " "KEY " " "typeName "varchar(20)"not null " "类型名 " "price "int "not null " "价格 " 4. 房间信息表:tbroom "字段名 "数据类型 "空/非空 "约束条件 "其他说明 " "roomId "int "not null "IDENTITY(1"房间ID " " " " ",1) " " " " " "PRIMARY " " " " " "KEY " " "roomNum "int "not null " "房间号 " "typeId "int "not null "foreign "房间类型I" " " " "key "D " " " " "REFERENCES" " " " " "tbtype(typ" " " " " "eId) " " "status "varhar(10) "not null " "房间状态 " 5. 客户住房登记信息表:tbcheckin "字段名 "数据类型 "空/非空 "约束条件 "其他说明" "checkId "int "not null"IDENTITY(1,1) "登记ID " " " " "PRIMARY KEY " " "roomNum "int "not null"foreign key "房间号 " " " " "REFERENCES " " " " " "tbroom(roomNum" " " " " ") " " "clientId "int "not null"foreign key "客户ID " " " " "REFERENCES " " " " " "tbclient(clent" " " " " "Id) " " "startDate "date "not null" "预订入住" " " " " "日期 " "lastDate "date "not null" "退房日期" "spe "varchar(50" " "描述 " " ") " " " " ----------------------- 酒店订房系统数据库设计全文共4页,当前为第1页。 酒店订房系统数据库设计全文共4页,当前为第2页。 酒店订房系统数据库设计全文共4页,当前为第3页。 酒店订房系统数据库设计全文共4页,当前为第4页。
要利用MySQL进行复杂的数据分析,可以采取以下方法: 1. 使用SQL查询语言: - 学习和掌握SQL语言的高级特性,如子查询、联合查询、窗口函数等,以进行复杂的数据查询和分析。 - 使用聚合函数(如SUM、AVG、COUNT等)对数据进行统计和计算,以获取所需的指标和汇总信息。 - 利用条件筛选(WHERE子句)、排序(ORDER BY子句)和分组(GROUP BY子句)等功能来组织和处理数据。 2. 利用MySQL的内置函数和操作符: - MySQL提供了丰富的内置函数,如数学函数、字符串函数、日期和时间函数等,可以用于数据处理和计算。 - 使用MySQL的操作符(如逻辑操作符、比较操作符等)进行条件筛选、计算和逻辑操作。 3. 编写存储过程和触发器: - 存储过程是一组预编译的SQL语句,可以在MySQL中创建和执行。你可以编写存储过程来实现复杂的数据处理逻辑和分析操作。 - 触发器是与表相关联的一种特殊类型的存储过程。你可以使用触发器在特定的数据变化时执行相应的操作,例如更新汇总数据或生成报表。 4. 使用临时表和表连接: - 创建临时表来存储中间结果,以便在复杂数据分析中进行多次计算和操作。 - 利用表连接(JOIN)来关联多个表,以便在查询中获取相关的数据。 5. 结合其他工具和库: - 使用MySQL的连接器(如JDBC、ODBC等)将数据导入到其他数据分析工具中,如Excel、Tableau等,以利用它们的高级分析和可视化功能。 - 通过使用MySQL的扩展工具或第三方库,如MySQL Workbench、DataGrip等,可以提供更高级的查询和分析功能。 需要根据具体的数据分析需求和数据结构灵活选择方法,并结合相应的技术和工具。了解SQL语言和MySQL的功能特性对于进行复杂数据分析是非常重要的。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值