Forum

Posted by Amy, Feb. 23, 2023, 12:50 p.m.

#52 why there could be film_id that is not in film_actor table?

I was assuming all film_id in film table should have a list of their casts under film_actor table, but that seems not the case. I am trying to understand why this could happen.

My testing query is:

select film.film_id
from film
left join film_actor
on film.film_id=film_actor.film_id
where film_actor.film_id is null

 

Return results:

 

film_id
257
323
803

Answers

Hi Amy,

This was designed on purpose, which really mimicks this movie rental business, and I am glad you found it.

The idea is that the dvd store may not have the entire catalog of films, e.g., a dvd was lost, or the store simply do not carry that title anymore.

That's why there is a discrepancy between film and film_actor.

Hope it makes sense.

Leon

 

SQLPad user avatar

Leon (949)

Feb. 23, 2023, 12:58 p.m.