INDEX
1. ACKNOWLEDGEMENT
2. AIM
3. APPARATUS
4. TABLE STRUCTURE
5. SYNOPSIS
6. PROGRAM
7. PROGRAM OUTPUT
8. BIBLIOGRAPHY
ACKNOWLEDGEMENT
I wholeheartedly thankthe Almightyfor
blessing me with the strength,
determination, and wisdom to complete
this project successfully. I am sincerely
grateful to Mrs. Reshmi S Rajan for her
constant guidance, encouragement, and
valuable insights that shaped this work. I
would also like to extend my appreciation
to my group members for their
cooperation and commitment, as well as
to everyone who, in one way or another,
contributed to the completion and
success of this project.
AIM
The aim of thisprojectistodevelop a
Hotel ManagementSystemthat
efficiently organizes,manages, and
tracks hotel operations. Thissystem will
automate key functions, such as room
booking, check-in, check-out, and billing,
to enhance overall efficiency and improve
the experience for both hotel staff and
guests.
APPARATUS
HARDWARE
• OPTICALMOUSE
• 101 KEYBOARD
• INKJET PRINTER
• MONITOR
• CORE i6 PROCESSOR
SOFTWARE
• PYTHON3.8.1
• MYSQL 5.7
• WINDOWS 8.1
• MS WORD 2007
STRUCTURE OFTABLE’HOTEL’
+--------------+--------------+------+------+----------+------+
|Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+------+----------+------+
|slno | int | NO | PRI | NULL | |
|type__ | char(25) | YES | | NULL | |
|no_of_rooms | int | YES | | NULL | |
|amount | int | YES | | NULL | |
+----------------+------------+------+------+----------+-------+
STRUCTURE OF TABLE ‘CUSTOMER’
+-------------------+-------------+------+-----+---------+-------+
|Field | Type | Null | Key | Default | Extra |
+-------------------+-------------+------+-----+---------+-------+
|custno | int | NO | PRI | NULL | |
|roomno | int | YES | | NULL | |
|type_ | char(25) | YES | | NULL | |
|checkin_date | char(10) | YES | | NULL | |
|checkout_date | char(10) | YES | | NULL | |
|cpr | float(10,1) | YES | | NULL | |
+-------------------+--------------+------+-----+---------+-------+
SYNOPSIS
The project’s aim isto develop a Hotel Management
System using Python and SQL to efficiently manage
hotel operations. The system provides a user-friendly
interface for hotel staff to perform a variety of tasks.
These operations include adding new records to the
guest and room tables, updating existing entries, and
deleting records as required. Additionally, the system
will support room booking, check-in, and check-out
processes to ensure accurate tracking of room
availability and guest stays. It will also display all
contents of both guest and room tables, allowing for
easy review and effective management of the hotel’s
data.
FUNCTION TO CREATE TABLE ‘HOTEL’
def create1():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
qry='''create table if not exists Hotel
(slno int not null primary key,
type__ char(25),
no_of_rooms int,
amount int);'''
cur.execute(qry)
except Exception as e:
print('error=',e)
mycon.close()
cur.close()
FUNCTION TO CREATE TABLE ‘CUSTOMER’
defcreate2():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
qry='''create table if not exists customer
(custno int not null primary key,
roomno int ,
type_ char(25),
checkin_date char(10),
checkout_date char(10),
cpr float(10,1));'''
cur.execute(qry)
except Exception as e:
print('error=',e)
mycon.close()
cur.close()
FUNCTION TO ADD RECORDS INTO ‘HOTEL’
definsert1():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
ans='y'
whileans=='y':
slno=int(input('Enter the SLNO:'))
type__=input('Enter Type')
no_of_rooms=int(input('Enter the No. of ROOMS'))
amount=int(input('Enter The Amount:'))
print('')
query='''insert into hotel
values({},'{}',{},{});'''.format(slno,type__,no_of_rooms,amount)
cur.execute(query)
mycon.commit()
ans=input("Do you want to continue(y/n):")
exceptException as e:
print('error=',e)
cur.close()
mycon.close()
FUNCTION TO ADD RECORDS INTO ‘CUSTOMER’
def insert2():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
ans='y'
while ans=='y':
custno=int(input('Enter the Customer No:'))
roomno=int(input('Enter Room No:'))
type_=input('Enter the Type:')
chin_d=input("Enter the Check-in_Date:")
chout_d=input("enter the Check-out_Date:")
cpr=int(input("Enter the Cost of Room per day:"))
query='''insert into customer
values({},{},'{}','{}','{}',{});'''.format(custno,roomno,type_,chin_d,chout_d,cpr)
cur.execute(query)
mycon.commit()
ans=input("Do you want to continue(y/n):")
print('')
except Exception as e:
print('error=',e)
cur.close()
mycon.close()
FUNCTION TO DELETE RECORD FROM ‘HOTEL’
defdeletion2():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
custnom=input('Enter the HOTEL NUMBER:')
qry='''select * from hotel where slno={}'''.format( custnom)
cur.execute(qry)
data=cur.fetchall()
ifdata==[]:
print('HOTEL NOT FOUND :( .....!')
print('')
else:
print(data) print('Do you want to remove
the hotel?') print('') ans='y'
ans=input('y/n') ifans=='y':
qry1='''delete from hotel where slno={}'''.format(custnom)
cur.execute(qry1)
print('Excecution done')
print('')
mycon.commit()
except Exception as e:
print('error=',e)
cur.close()
mycon.close()
print('Booking canceled for Custno', custnom)
print('')
FUNCTION TO DELETE RECORD FROM ‘CUSTOMER’
def deletion2():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
custnom=input('Enter the HOTEL NUMBER:')
qry='''select * from hotel where slno={}'''.format( custnom)
cur.execute(qry)
data=cur.fetchall()
ifdata==[]:
print('HOTEL NOT FOUND :( .....!')
print('')
else:
print(data) print('Do you want to remove
the hotel?') print('') ans='y'
ans=input('y/n') ifans=='y':
qry1='''delete from hotel where slno={}'''.format(custnom)
cur.execute(qry1)
print('Excecution done')
print('')
mycon.commit()
except Exception as e:
print('error=',e)
cur.close()
mycon.close()
print('Booking canceled for Custno', custnom)
print('')
FUNCTION TO MODIFY A RECORD FROM ‘HOTEL’
defupdation():
try:
mycon=sqlcon.connect(host='localhost', user='root', password='12345',
database='projectxiia')
cur = mycon.cursor()
s=int(input('ENTERTHE SLNO TO BE SEARCHED: '))
qry='''select*fromhotel where slno={}'''.format(s)
cur.execute(qry)
data = cur.fetchall()
if data == []:
print('Norecordsfound')
print('')
else:
print("Existingrecord:", data)
confirm=input("Areyou sure you want to update this record? (y/n): ").lower()
ifconfirm=='y':
t=input('Enterthenew type: ')
n=int(input('Enterthe new no of rooms: '))
a=int(input('Enterthe new amount: '))
print('')
qry1='''updatehotel
settype__='{}',no_of_rooms={}, amount={} where slno={}'''.format(t, n, a, s)
cur.execute(qry1)
mycon.commit()
print("Recordupdated successfully!")
else:
print("Updatecancelled.")
print('')
exceptExceptionase:
print('error =', e)
finally:
cur.close()
mycon.close()
FUNCTION TO MODIFY A RECORD FROM ‘CUSTOMER’
defupdation1():
try:
mycon=sqlcon.connect(host='localhost', user='root', password='12345',
database='projectxiia’ )
cur = mycon.cursor()
s=int(input('Enterthecustomertobe searched: '))
print('')
qry='''select*fromcustomerwhere custno={}'''.format(s)
cur.execute(qry)
data = cur.fetchall()
if data == []:
print('No records found')
print('')
else:
print("Existing record:", data)
confirm=input("Areyousureyouwant to update this record? (y/n): ").lower()
ifconfirm=='y':
roomno=int(input('Enterthenew room number: '))
t = input('Enter the new Type: ')
a=input('EnterthenewCheckin_date (YYYY-MM-DD): ')
b=input('EnterthenewCheckout_date (YYYY-MM-DD): ')
c=float(input('Enterthenewcpr: '))
print('')
qry1 = '''update customer
setroomno={},type_='{}',checkin_date='{}', checkout_date='{}', cpr={}
wherecustno={}'''.format(roomno, t, a, b, c, s)
cur.execute(qry1)
mycon.commit()
print("Recordupdatedsuccessfully!")
else:
print("Update cancelled.")
print('')
exceptExceptionase:
print('error =', e)
finally:
cur.close()
mycon.close()
FUNCTION TO DISPLAY ALL RECORDS OF ‘HOTEL’
defdisplayhotel():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
qry='''select * from hotel'''
cur.execute(qry)
data=cur.fetchall()
ifdata==[]:
print('TABLE DOES NOT EXIST!')
print('')
print('slno','\t','type','\t','rooms','\t','amount')
for i in data:
print(i[0],'\t',end='')
print(i[1],'\t',end='')
print(i[2],'\t',end='')
print(i[3],'\t')
except Exception as e:
print('error=',e)
cur.close()
mycon.close()
FUNCTION TO DISPLAY ALL RECORDS OF ‘CUSTOMER’
defdisplaycustomer():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
qry='''select * from customer'''
cur.execute(qry)
data=cur.fetchall()
ifdata==[]:
print('TABLE DOES NOT EXIST!')
print('')
print('cno','\t','rno','\t','typ','\t','idate','\t','odate','\t','cpr')
for i in data:
print(i[0],'\t',end='')
print(i[1],'\t',end='')
print(i[2],'\t',end='')
print(i[3],'\t',end='' )
print(i[4],'\t',end='')
print(i[5],'\t')
except Exception as e:
print('error=',e)
cur.close()
mycon.close()
FUNCTION TO SEARCH AND DISPLAY A RECORD FROM ‘CUSTOMER’
defreport():
try:
mycon=sqlcon.connect(host='localhost',user='root',password='12345',database='projectxiia')
cur=mycon.cursor()
s=int(input('Enter the customer to be searched'))
print('')
qry='''select * from customer where custno={} '''. format(s)
cur.execute(qry)
data=cur.fetchall()
ifdata==[]:
print('CUSTOMER NUMBER NOT FOUND!')
print('')
print('cno','\t','rno','\t','typ','\t','idate','\t','odate','\t','cpr')
for i in data:
print(i[0],'\t',end='')
print(i[1],'\t',end='')
print(i[2],'\t',end='')
print(i[3],'\t',end='' )
print(i[4],'\t',end='')
print(i[5],'\t')
except Exception as e:
print('error=',e)
cur.close()
mycon.close()
MENU-DRIVEN MAIN PROGRAM
#main
user=input("Enter username")
password=input('Enter the Password:')
ifuser=='root' and password=='12345':
foriinrange(0,101,10):
print("LOADING....",i,'%')
print("ACCESS GRANTED :).....") print('') print('')
print('======================WELCOME BACK========================')
print() print('----------------HOTEL MANAGEMENT SYSTEM-------------------') print()
print('=========================MENU=============================')
ch=0 print() whilech!=7:
print('1.Add Data')
print('2.Cancelation')
print('3.Updation')
print('4.Report')
print('5.Back')
print('')
print()
ch=int(input('Enter Choice:'))
print('')
print()
#CHOICE 1 (INSERTING INTO THE TABLES)
ifch==1:
flag=0
while flag!=3:
print ('--+'*20)
print("1.Insert into Hotel Data")
print("2.Insert into Customer Data ")
print('3.Back')
print ('--+'*20)
print('')
flag=int(input("Enter your choice"))
print('')
ifflag==1:
insert1()
print('')
ifflag==2:
insert2()
print('')
ifflag==3:
print("Redirecting Back to menu...")
print('')
#CANCELATION CHOICE 2
elifch==2:
flag= 0
while flag != 3:
print ('--+'*20)
print("1.Cancel CUSTOMER Booking")
print("2.Delete HOTEL Details")
print("3.Back")
print ('--+'*20)
print('')
flag = int(input("Enter your choice: "))
print('')
ifflag == 1:
deletion()
print('')
elif flag == 2:
deletion2()
print('')
elif flag == 3:
print("Redirecting Back to menu...\n")
#CHOICE 3
elifch==3:
whileTrue:
print('--+'*20)
print("1.Update Hotel information")
print("2.Update Customer Details")
print('3.Back')
print('--+'*20)
print('')
flag=int(input("Enter your choice: "))
print('')
ifflag== 1:
updation()
print('')
elifflag == 2:
updation1()
print('')
elifflag == 3:
print("Redirecting Back to menu...")
print('')
break
else:
print("Invalid choice, try again.")
print('')
#CHOICE 4
if ch==4:
flag=0
whileflag!=4:
print('--+'*20)
print("1.DIPLAY PARTICULAR CUSTOMER DETAILS")
print("2.DISPLAY CUSTOMER DETAILS")
print("3.DISPLAY HOTEL DETAILS")
print('4.Back')
print('--+'*20)
print('')
flag=int(input("Enter your choice"))
print('')
ifflag==1:
report()
print('')
elifflag==2:
displaycustomer()
print('')
elifflag==3:
display()
else:
print('Redirecting')
#CHOICE 5
ifch==5:
for i in range(0,101,10):
print("LOADING....",i,'%')
print("Exitting the program.........")
break
else:
print("WRONG CREDENTIAL")
OUTPUT
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter usernameroot Enter the Password:12345
LOADING.... 0 % LOADING.... 10 % LOADING.... 20 %
LOADING.... 30 % LOADING.... 40 % LOADING.... 50 %
LOADING.... 60 % LOADING.... 70 % LOADING.... 80 %
LOADING.... 90 % LOADING.... 100 % ACCESS GRANTED
:).....
======================WELCOME BACK========================
----------------HOTEL MANAGEMENT SYSTEM-------------------
=========================MENU=============================
1.Add Data
2.Cancelation
3.Updation
4.Report
5.Back
Enter Choice:1
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Insert into Hotel Data
2.Insert into Customer Data
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice1
Enter the SLNO:1
Enter Typeac
Enter the No. of ROOMS2
Enter The Amount:150
Do you want to continue(y/n):y
Enter the SLNO:2
Enter Typenon ac
Enter the No. of ROOMS5
Enter The Amount:200
Do you want to continue(y/n):y
Enter the SLNO:3
Enter Typeac
Enter the No. of ROOMS1
Enter The Amount:250
Do you want to continue(y/n):n
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Insert into Hotel Data
2.Insert into Customer Data
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice2
Enter the Customer No:1
Enter Room No:1
Enter the Type:ac
Enter the Check-in_Date:2025-02-02
enter the Check-out_Date:2025-02-05
Enter the Cost of Room per day:100
Do you want to continue(y/n):y
Enter the Customer No:2
Enter Room No:2
Enter the Type:non ac
Enter the Check-in_Date:2025-03-05
enter the Check-out_Date:2025-03-06
Enter the Cost of Room per day:500
Do you want to continue(y/n):y
Enter the Customer No:3
Enter Room No:3
Enter the Type:ac
Enter the Check-in_Date:2025-04-01
enter the Check-out_Date:2025-04-06
Enter the Cost of Room per day:300
Do you want to continue(y/n):n
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Insert into Hotel Data
2.Insert into Customer Data
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice3
Redirecting Back to menu...
1.Add Data
2.Cancelation
3.Updation
4.Report
5.Back
Enter Choice:2
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Cancel CUSTOMER Booking
2.Delete HOTEL Details
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice: 1
Enter the custno:1
[(1, 1, 'ac', '2025-02-02', '2025-02-05', 100.0)]
Do you want to cancel Booking?
y/n: y
Execution done
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Cancel CUSTOMER Booking
2.Delete HOTEL Details
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice: 2
Enter the HOTEL NUMBER:1
[(1, 'ac', 2, 150)]
Do you want to remove the hotel?
y/ny
Excecution done
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Cancel CUSTOMER Booking
2.Delete HOTEL Details
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice: 3
Redirecting Back to menu...
1.Add Data
2.Cancelation
3.Updation
4.Report
5.Back
Enter Choice:3
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Update Hotel information
2.Update Customer Details
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice: 1 ENTER THE SLNO TO BE SEARCHED:
2
Existing record: [(2, 'non ac', 5, 200)]
Are you sure you want to update this record? (y/n): y
Enter the new type: ac
Enter the new no of rooms: 2
Enter the new amount: 175
Record updated successfully!
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Update Hotel information 2.Update Customer Details
3.Back --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
+
Enter your choice: 2 Enter the customer to be searched: 3
Existing record: [(3, 3, 'ac', '2025-04-01', '2025-04-06', 300.0)]
Are you sure you want to update this record? (y/n): y
Enter the new room number: 4
Enter the new Type: non ac
Enter the new Checkin_date (YYYY-MM-DD): 2025-04-08
Enter the new Checkout_date (YYYY-MM-DD): 2025-04-12
Enter the new cpr: 285
Record updated successfully!
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.Update Hotel information
2.Update Customer Details
3.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice: 3 Redirecting Back to menu... 1.Add
Data
2.Cancelation
3.Updation
4.Report
5.Back
Enter Choice:4
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.DIPLAY PARTICULAR CUSTOMER DETAILS
2.DISPLAY CUSTOMER DETAILS
3.DISPLAY HOTEL DETAILS
4.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice1
Enter the customer to be searched3
cno rno typ idate odate cpr
3 4 non ac 2025-04-08 2025-04-12 285.0
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.DIPLAY PARTICULAR CUSTOMER DETAILS
2.DISPLAY CUSTOMER DETAILS
3.DISPLAY HOTEL DETAILS
4.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice2
cno rno typ idate odate cpr
2 2 non ac 2025-03-05 2025-03-06 500.0
3 4 non ac 2025-04-08 2025-04-12 285.0
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.DIPLAY PARTICULAR CUSTOMER DETAILS
2.DISPLAY CUSTOMER DETAILS
3.DISPLAY HOTEL DETAILS
4.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice3
======HOTEL========
Slno. Type Rooms Amount
2 ac 2 175
3 ac 1 250
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1.DIPLAY PARTICULAR CUSTOMER DETAILS
2.DISPLAY CUSTOMER DETAILS
3.DISPLAY HOTEL DETAILS
4.Back
--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Enter your choice4
Redirecting
1.Add Data
2.Cancelation
3.Updation
4.Report
5.Back
Enter Choice:5
LOADING.... 0 %
LOADING.... 10 %
LOADING.... 20 %
LOADING.... 30 %
LOADING.... 40 %
LOADING.... 50 %
LOADING.... 60 %
LOADING.... 70 %
LOADING.... 80 %
LOADING.... 90 %
LOADING.... 100 %
Exitting the program.........
BIBLIOGRAPHY
• COMPUTER SCIENCE
• TEXTBOOK
• GOOGLE
• WIKIPEDIA
CONCLUSION
Thank you for spending your time reading this
conclusion of our hotel management project. We've
highlighted the essential role effective management
plays in the success of the hospitality industry. By
integrating innovative technology, enhancing guest
services, and optimizing operational efficiencies, we've
shown how hotels can elevate their service standards
and improve guest satisfaction. Key findings underline
the importance of personalized experiences,
sustainable practices, and staff training to stay
competitive. As the industry evolves, it's crucial for
hotel managers to adapt to emerging trends and use
data-driven insights to meet guest needs and ensure a
memorable stay. This project provides a roadmap for
future endeavors in hotel management, showcasing
best practices and strategies for growth and success.