I have this tables
Movie a
id title yr score votes
-- -------------- ---- ----- -----
1 ‘Harry Potter’ 1985 9.98 2
2 ‘Beasdas’ 1985 5.28 3
actor b
id name
-- --------------
1 ‘Keanu Reeves’
casting c
movieid actorid ord
------- ------- ---
1 1 2
I want to List the film title and the leading actor for all of ‘Julie Andrews’ films.
Is this correct?
SELECT title, name
FROM movie a, actor b, casting c
WHERE title IN(SELECT title
FROM movie a, actor b, casting c
WHERE name = 'Julie Andrews' AND
a.id = c.movieid AND
b.id = c.actorid) AND
ord = '1' AND
a.id = c.movieid AND
b.id = c.actorid;
If you want all results where ‘Julie Andrews’ is the lead actor then this is what you need:
On the other hand if you need all films where ‘Julie Andrews’ had a role, but not necessarily being the lead actor then you need the following:
Hope this helps!