Maximum Duration of the Stay in SQL

Question:

Maximum Duration of the Stay

The manager has to calculate the maximum duration of stay in any resort. Write a query to find maximum number of days stayed by the guest. Give alias name to the result as “MAXIMUMDAYS”.

[Hint : number of days can be calculated using fromdate and todate of booking details]

Maximum Duration of the Stay

Code:

Main.sql

select max(todate-fromdate) as MAXIMUMDAYS 
from booking;

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x