the first thing you need to do is learn how to write joins
have a look at this --
Code:
FROM film
INNER
JOIN inventory
ON inventory.film_id = film.film_id
INNER
JOIN rental
ON rental.inventory_id = inventory.inventory_id
INNER
JOIN customer
ON customer.customer_id = rental.customer_id
AND customer.last_name LIKE 'A%'
WHERE film.title LIKE 'W%'
please notice how the sequence in which the tables are joined make sense logically
you start with films which begin with W
then you find all the inventory for those films, then all the rentals for those inventories, then all the rental customers who start with A
at each step along the way, it's very clear as to which table is being added, and on what column
notice how the ON clauses mention the column from the table being joined first, and then equate that column to a column of a table previously mentioned
this style makes queries
very easy to understand, and to debug