Need help creating views please! Heres how the database is built. 4. (5 points)
ID: 3733974 • Letter: N
Question
Need help creating views please!
Heres how the database is built.
4. (5 points) Specify the following views in SQL on the IDEALHOME database schema 1) Create a view of staff who manage properties for rent, which includes the branch 2) Create a view for the property Owner including the owner's first name, last name, and show the results though screenshot. name they work at, their staff number, and the number of properties they manage. telNo. It will also include the propertyNo, type, rent, handling staff's fhame and lnameExplanation / Answer
Solution:
1)
Query:
CREATE VIEW [StaffView] AS
SELECT branchNo, staffNo, COUNT(propertyNo)
FROM staff INNER JOIN propertyforrent ON staff.staffNo= propertyforrent.staffNo INNER JOIN branch ON branch.branchNo= propertyforrent.branchNo
2)
CREATE VIEW [propertyOwner] AS
SELECT fName, lName, telNo, propertyNo, type, staff.fName, staff.lName, rent
FROM staff INNER JOIN propertyforrent ON staff.staffNo= propertyforrent.staffNo INNER JOIN branch ON branch.branchNo= propertyforrent.branchNo INNER JOIN registration ON registration.branchNo= branch.branchNo INNER JOIN client ON client.clientNo= registration.clientNo.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.