w3resource

SQL exercises on movie Database: Find the cast list for the movie Chinatown

SQL movie Database: Join Exercise-19 with Solution

19. Write a query in SQL to find the cast list for the movie Chinatown.

Sample table: movie


Sample table: movie_cast


Sample table: actor


Sample Solution:

SELECT a.act_fname, a.act_lname
FROM
movie_cast c
JOIN actor a ON
c.act_id = a.act_id
Where mov_id = (
SELECT mov_id
FROM movie
Where mov_title = 'Chinatown');

Sample Output:

      act_fname       |      act_lname
----------------------+----------------------
 Jack                 | Nicholson
(1 row)

Practice Online


Movie database model

Query Visualization:

Duration:

Query visualization of Find the cast list for the movie Chinatown - Duration

Rows:

Query visualization of Find the cast list for the movie Chinatown - Rows

Cost:

Query visualization of Find the cast list for the movie Chinatown - Cost

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a query in SQL to find the first and last name of an actor with their role in the movie which was also directed by themselve.
Next: Write a query in SQL to find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford'.

What is the difficulty level of this exercise?