Chat with us, powered by LiveChat CMPSC 321 Database | WriteDemy

Question Description

1:1: Some fun with joins and aggregates1. Use the HAFH database. I want to find the number of managers living in each building. Use thesteps below to guide you. The final result should look like this:a. For each manager, list the first and last name of the manager and the building ID of thebuilding the manager resides in.b. This can be restated as follows: For each building with a manager living in it, list the firstand last name of the manager and the building ID.c. Why are some of the buildings not listed in the result? Is there a way to list them as well?(Hint: use an outer join.)d. Modify the above query so that the building ID of each building is listed along with thenumber of managers living there, instead of the names of the managers. (Hint: use GROUP BYand COUNT, and remove the manager names.)e. Show the query and the result to the instructor when you have it finished.2. I want a list of the corporate clients and the number of referrals each has made. Again, use thehints below. The final result should look like this:a. For each corporate client, display the client’s name as well as the name of the client whoreferred this client. (See example from class.)b. Is everyone listed? Who is missing? Use an outer join to include them all.c. Modify this query to count the number of referrals each client has made.d. Copy the query and result into a Word document to submit to Canvas.Task 2: Fun with SELECT.buildingid numResidentManagersB1 1B2 1B3 0B4 1B5 1B6 0B7 1B8 1B9 0ccname numReferralsBlingNotes 3NanoCorp 1SkyJet 1WindyCT 1CommuteAir 0DelishInc 0EntertainUs 0SouthAlps 0Xilerate 03. Try each of these in MySQL (you can use PhpMiniAdmin).a. SELECT 3+4+5b. SELECT 3+4+NULL+5c. SELECT SUM(mbonus) FROM managerd. SELECT SUM(msalary) FROM managere. SELECT SUM(msalary) FROM manager WHERE msalary>50000f. SELECT SUM(msalary) FROM manager WHERE msalary>70000g. SELECT COUNT(managerid) FROM manager WHERE msalary>50000h. SELECT COUNT(managerid) FROM manager WHERE msalary>70000Task 3: More fun with joins and aggregates4. Make a note of the number of corporate clients in the database: ______a. Join the corpclient table with the apartment table to get a list of corporate client names, thebuilding ID and apartment number of the apartments they are leasing, and the number ofrooms in the apartment. Make a note of the number of records: _____ Why is this more thanthe number of clients in the database?b. Modify the above query so that the total number of rooms leased by each client appears.(Hint: use GROUP BY and remove the building ID and apartment number columns.) Make anote of the number of records: ______ Why is this less than the total number of clients?c. Use an outer join to include all the clients.d. Make sure 0 appears instead of NULL for clients who are leasing 0 rooms. Check StackOverflow for a hint (https://stackoverflow.com/questions/7602271/how-do-i-get-sumfunction-in-mysql-to-return-0-if-no-values-are-found).e. Copy the query and the result into the document from Task 1. Submit it on Canvas.

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order