Question
Copy the following questions. Then, go to DBeaver, right click on hafh database, SQL Editor, New SQL Script. In the blank window, paste these questions.
Copy the following questions. Then, go to DBeaver, right click on hafh database, SQL Editor, New SQL Script. In the blank window, paste these questions. You will be writing SQL queries against hafh database. The ER diagram and schema of this database is provided in the homework. # Write your answers below each question, and run them to make sure they work. # When done, select the entire code, copy and past it in the same Word document (that # you created in PARTA) # This is a database about a company which rents apartments to people and corporate # customers. # Q1. Show buildingID, aptno and number of bedrooms from the apartment table where # bedrooms are 2 or more. # Q2. Show first name, last name, salary and birthday of managers whose salary is # greater than 51000 and birthday is after "1970-01-01" # Hint: for the "after" in birthday criteria, use greater than symbol ">" # Q3. The company will make a salary increase for managers whose salary is less than # 60 and never received a bonus. # The salary increase is 15%. Show eligible people's last name, current salary and # salary amount after the increase. # Hint: Use "IS NULL" to see if the bonus variable has NULL value. # Q4. Show CCIDs of corporate clients in the apartment table but show CCIDs only # once, don't let them repeat. # Q5. Show all the information in the Inspecting table, sorted by date of last # inspection and date of next inspection; in descending order of next inspection. # Q6. Show total and average number of rooms in each building using apartments table # (Hint: use Group By) # Q7. Show building manager's first and last names, building ID, building's number of # floors. HINT: Inner join by managerID. # Q8. Show buildingID, aptno, CCName, CCIndustry and CCLocation which is Chicago. # HINT: Inner join by CCID. # ---- END of Homework
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