Question: Using the views vhotel, vroom, vguest and vbooking, code a function that calculates the cost of a guest's stay given a bookingno as a parameter.
Using the views vhotel, vroom, vguest and vbooking, code a function that calculates the cost of a guest's stay given a bookingno as a parameter. Call the function BOOKINGPRICE(). The function take an input INT parameter of the bookingNo and calculates the booking price using the formula:
Cost of Stay = No of Days * Price of room/Day L> booking.room.price column | datediff(Checkout date,Checkin Date) 4. Test your results by running a query that reports the booking price and the following columns. Report should be for all bookings. Pass the bookingNo to the bookingprice() function in the SQL, and use bookingprice() function to calculate the tax and service charge. Hotel Name, Guest Name, Check-in Date, Check-out Date, Price of Stay, Tax, Service charge
Where tax is bookingprice * .875 and service charge is bookingprice * .18.
What is the SQL code to be able to see the reports booking while using the function?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
