36. Actors from film 'AFRICAN EGG'

easy

Instruction
  • Write a query to return the first name and last name of all actors in the film 'AFRICAN EGG'.
  • The order of your results doesn't matter.

Table 1: actor


  col_name   | col_type
-------------+--------------------------
 actor_id    | integer
 first_name  | text
 last_name   | text

Table 2: film


       col_name       |  col_type
----------------------+--------------------------
 film_id              | integer
 title                | text
 description          | text
 release_year         | integer
 language_id          | smallint
 original_language_id | smallint
 rental_duration      | smallint
 rental_rate          | numeric
 length               | smallint
 replacement_cost     | numeric
 rating               | text

Table 3: film_actor

Films and their casts


  col_name   | col_type
-------------+--------------------------
 actor_id    | smallint
 film_id     | smallint

Sample results


 first_name | last_name
------------+-----------
 GARY       | PHOENIX
 DUSTIN     | TAUTOU

Solution postgres

SELECT A.first_name, A.last_name
FROM film F
INNER JOIN film_actor FA
ON FA.film_id = F.film_id
INNER JOIN actor A
ON A.actor_id = FA.actor_id
WHERE F.title = 'AFRICAN EGG';
    

Explanation

This query is selecting the first and last names of actors who have acted in the film 'AFRICAN EGG'. To do this, it's joining three tables - 'film', 'film_actor', and 'actor' - using the 'film_id' and 'actor_id' columns. The 'WHERE' clause is limiting the results to only show actors who have acted in the film 'AFRICAN EGG'.

Last Submission postgres

Expected results



More INNER JOIN questions

ID Title Level FTPR
213 Interchange revenue by issuer and merchant category visa easy
70%
179 Members who ever moved from Microsoft to Google linkedin medium
31%
162 Number of orders per brand walmart easy
41%
150 Countries with above average customers google easy
15%
99 Page recommendation facebook medium
13%
91 same day friend request acceptance rate spotify easy
13%
50 Top 5 cities for movie rentals easy
22%
49 Top 3 money making movie categories medium
18%
48 Movie and TV actors easy
38%
40 Top 2 most rented movie in June 2020 medium
14%
39 Most productive actor with inner join easy
22%
38 Most popular movie category (name and id) medium
19%
37 Most popular movie category easy
15%