Menu

[35b350]: / Sample Query 7.sql  Maximize  Restore  History

Download this file

12 lines (9 with data), 361 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
/*List the hotels located in "Hoboken", sort by average guest score*/
select HotelName, 0 as 'Average Score' from hotels
where Hcity="Hoboken"
and hotels.HotelID not in (select HotelID from reviews)
union
select HotelName, Avg(Score) as 'Average Score' from reviews, hotels
where reviews.HotelID=hotels.HotelID
and Hcity="Hoboken"
group by reviews.HotelID