New to learning SQL and just wondering about how indexes work, for example (primary keys as bolded):
- Hotel (hotelNo, hotelName, city),
- Room (roomNo, hotelNo, type, price),
- Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo),
- Guest (guestNo, guestName, guestAddress)
Query:
SELECT 
    r.roomNo, r.type, r.price 
FROM 
    Room r, 
    Booking b, Hotel h 
WHERE 
    r.roomNo = b.roomNo 
    AND b.hotelNo = h.hotelNo 
    AND h.hotelName = "Hilton" 
    AND r.price > 200
Can someone explain how I would use any indexing to improve query performance? I was thinking of just sorting it by price, that way the SQL Server doesn't have to check every line manually but are there any other indexes that should be built upon? Additionally, are primary keys always clustered indexes?
 
    