Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Install PostgreSQL. For the below schema for a company door: doorlog(eventid,doorid,tim,username,event) Where doorid represents the door for this event. e.g. Front door may be doorid=1,
Install PostgreSQL. For the below schema for a company door: doorlog(eventid,doorid,tim,username,event) Where doorid represents the door for this event. e.g. Front door may be doorid=1, and bathroom may be doorid=2, etc. tim is timestamp, username is the user who is opening or closing the door. event is "E" for entry, and "X" for exit. Using SQL, answer these questions (write a SQL query that answers these questions): How many users entered through doorid=1 If doorid=2 is bathroom, how many people are currently in the bathroom? If doorid=1 is front entrance door, and doorid=3 is back entrance door, and these are the only doors in the building, how many people are currently in the building? How many people were in the building on July 4th, at 10PM? (watching fireworks) If doorid=7 is for floor 42, what's the daily occupancy of floor 42 for entire 2021 (give a number for every day in 2021; not just days that had activity; if nobody entered/left floor, then return 0 for that day) What is the daily average (and standard deveation) occupancy of floor 42 for 2021? (single number; use above question results) What percentage of the people work on floor 42 (assume if they entered the floor, they work there). What's the average number of times per day that people use the bathroom? (bathroom is doorid=2). What percentage of employees stayed after 5:15PM on July 3rd, 2022? List all employees who left work before 1PM on July 3rd, 2022 (assume they arrived to work on July 3rd, before 1pm)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started