Cognizant handson - Hotels that took order based on month

 

Hotels that took order based on month


Write a query to display distinct hotel id, hotel name, and rating of hotels that have taken order in the month of July. Sort the result based on hotel id in ascending order.

(HINT: Use Hotel_details and  Orders tables to retrieve records.Order date='2019-07-14')

NOTE: Maintain the same sequence of column order, as specified in the question description





Solution:

select distinct hotel_details.hotel_id,hotel_details.hotel_name,hotel_details.rating from hotel_details,orders where hotel_details.hotel_id=orders.hotel_id 
and monthname(order_date)='July';

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.