Question

The owner of the B&B would like to know how much each room contributes to total revenues. In this regard, she would like a list of rooms (room ID and room name), and how much revenue each room brought in for 2019 (even including rooms that did not bring in any revenue; i.e., they weren't booked in 2019). Room revenue (for a given booking) are found in the total field in Bookings. You only need to consider bookings where check-in is in 2019 (and hence don't filter for check-out dates that might occur in 2020). You do not need to consider any booking discounts that were given (i.e., the discount field in Bookings). She would like this list sorted from most revenue to least revenue.

In a single SQL statement, write the query that will provide the owner with this information.

Consider the following physical entity-relationship model for a small bed and breakfast (B&B) that has multiple locations in

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Select Rooms.room_id, room_name, sum(total) as revenue from Rooms left join Bookings on Rooms.room_id = Bookings.room_id group by Rooms.room_id, room_name having year(check_in) = 2019 order by revenue desc;

Do ask if any doubt. Please up-vote.

Add a comment
Know the answer?
Add Answer to:
The owner of the B&B would like to know how much each room contributes to total...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins...

    Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins use from clause) Need to Create a Query to display products purchased by customers in Germany that were not purchased by customers in the US. Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode Country Phone char(5) varchar(40) varchar(30) varchar(30) varchar(60) varchar(15) varchar(15) varchar(10) varchar(15) varchar(24) varchar(24) Order Details Orders PK OrderID int FK CustomerlD char(5) FK Employeeld int...

  • Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins...

    Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins use from clause) Need to Create a Query because Northwind Traders has decided to increase their retail prices. Write a query that shows the product name, the current price, and the new price. Make sure the new price is listed to 2 decimal points. Follow below guidelines on new retail price: a.         If the category is beverages or dairy products, increase the price by...

  • Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins...

    Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins use from clause) Need to Create a Query because Northwind Traders wants to make sure that all orders are shipped within 10 days. Display any orders that were not shipped within 10 days. Include the OrderID, the OrderDate, and the number of days it took before the order was shipped. Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode...

  • In using a database created from this model, which of the following SQL queries would give...

    In using a database created from this model, which of the following SQL queries would give us a list of customers who have daily deposit transactions (deposit is a transaction type) totaling $10,000 or more across all of their accounts (i.e., this is a total across all accounts of a customer, not per account). Include in this list the Customer ID and name, and the dates and their respective daily total. SELECT c.cust_id, c.cust_name, DATE(t.tran_date), SUM(t.tran_amount) AS daily_total FROM Customers...

  • making a file You are tasked with creating a text-based program for storing data on Hotel...

    making a file You are tasked with creating a text-based program for storing data on Hotel Room Bookings - however, as this is a comparative languages course, you will be creating the same application in the following three programming languages: • Java, • Python, and • Lisp As you implement the application in each language you should keep notes on: - The features of the languages used, - Which features you found useful, and - Any issues or complications which...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT