


The first example finds all hotels and the respective cities where the customer 'Porter' has booked a room. Three tables must be joined for this purpose.
SELECT customer.name, reservation.rno,
name_of_hotel = hotel.name, city
FROM customer, reservation, hotel
WHERE customer.name = 'Porter' AND
customer.cno = reservation.cno AND
reservation.hno = hotel.hno

Show all customers and the cities where they have booked a hotel. Values from the table 'reservation' are not displayed in this case. But the table is needed to retrieve the hotel number.
SELECT customer.name, hotel.city
FROM customer, reservation, hotel
WHERE customer.cno = reservation.cno AND
reservation.hno = hotel.hno



