w3resource
SQL exercises

SQL exercises on movie Database: Find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford'

SQL movie Database: Join Exercise-20 with Solution

20. Write a query in SQL to find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford'.

Sample table: movie


Sample table: movie_cast


Sample table: actor


Sample Solution:

SELECT m.mov_title
FROM  movie m
JOIN movie_cast c 
ON  m.mov_id = c.mov_id
WHERE c.act_id IN ( 
Select act_id 
FROM actor 
WHERE act_fname='Harrison' 
AND act_lname='Ford');

Sample Output:

                     mov_title
----------------------------------------------------
 Blade Runner
(1 row)

Practice Online


Movie database model

Query Visualization:

Duration:

Query visualization of Find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford' - Duration

Rows:

Query visualization of Find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford' - Rows

Cost:

Query visualization of Find the movie in which the actor appeared whose first and last name are 'Harrison' and 'Ford' - Cost

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

Previous: Write a query in SQL to find the cast list for the movie Chinatown.
Next: Write a query in SQL to find the highest-rated movie, and report its title, year, rating, and releasing country.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming