The input file holds a single building name exactly as stored in the classroom table (e.g. Ramanujan).
Write a program that reports classroom statistics for that building: how many classrooms it has, their total seating capacity, and the capacity of its single largest classroom.
Output a single row with three columns in this order, separated by one space:
num_rooms total_capacity max_capacity
num_rooms — count of classrooms in the building.total_capacity — sum of the capacities of those classrooms.max_capacity — the largest single-room capacity in the building.The query always returns exactly one row (a single aggregate over the building).
Note: Do not hard-code the database name — your program is run against a different database instance for evaluation. The input file is in the same folder as your program.
For the database connection, use these variables:
database = sys.argv[1] # database name, from the command line
user = os.environ.get('PGUSER')
password = os.environ.get('PGPASSWORD')
host = os.environ.get('PGHOST')
port = os.environ.get('PGPORT')
The input is a file named input.txt in the same folder — A single line containing a building name, e.g. Ramanujan.
primary keyforeign keyarrow points to the referenced columndrag to pan