Python Project With SQL - Hotel
Python Project With SQL - Hotel
In [ ]:
In [193]:
import sqlalchemy
In [194]:
In [195]:
In [196]:
Out[197]:
Out[198]:
name membercost
Tennis Court 1 5
Tennis Court 2 5
Badminton Court 0
Table Tennis 0
Massage Room 1 35
Massage Room 2 35
Snooker Table 0
Pool Table 0
Out[199]:
produce a list of facilities that charge a fee to members, and that fee is less than 1/50th of the
monthly maintenance cost
In [200]:
Out[200]:
Out[201]:
Out[202]:
produce a list of members who joined after the start of September 2012. Return the memid,
surname, firstname, and joindate of the members
In [203]:
Out[203]:
Out[204]:
surname
Bader
Baker
Boothe
Butters
Coplin
Crumpet
Dare
Farrell
Genting
GUEST
Out[205]:
latest_signup
2012-09-26 18:08:45
Produce a count of the number of facilities that have a cost to guests of 10 or more
In [206]:
Out[206]:
count
6
Produce a list of the total number of slots booked per facility in the month of September 2012.
Produce an output table consisting of facility id and slots, sorted by the number of slots
In [207]:
Out[207]:
facid total_slots
5 122
3 422
7 426
8 471
6 540
2 570
1 588
0 591
4 648
Produce a list of facilities with more than 1000 slots booked. Produce an output table consisting of
facility id and total slots, sorted by facility id.
In [208]:
Out[208]:
facid total_slots
0 1320
1 1278
2 1209
3 830
4 1404
5 228
6 1104
7 908
8 910
Produce a list of the start times for bookings for tennis courts, for the date '2012-09-21'.Return a list
of start time and facility name pairings, ordered by the time.
In [209]:
postgresql://postgres:***@localhost:5432/dvdrental
* postgresql://postgres:***@localhost:5432/hotel
12 rows affected.
Out[209]:
starttime name
complete!!