Table Manager

The restaurant manager can receive table reservation requests and operate on the database to update the booking records in the system. A reservation is requested by a guest that tells the manager: their name and personal phone number, number of guests for the table. For sake of simplicity, we assume the software manages only one evening. Here's a list of commands:

R guests number name - Reserve a table for g guest(s) under the name with specified (phone) number.
S t- Show the information of a certain reservation identified by t.
L - List all the reservations.
U - List all the unreserved tables, one per line.
NT - Output the number of reserved tables.
NT g - Output the number of tables that have a reservation for g guests each.
NG - Output the number of booked guests overall.
NU - Output the number of unreserved seats overall.
GU - Shows the information about table(s) with the greatest number of unreserved seats.
X - Exit.

Here's the .py and .sql code