In some cases, we may need to call a View Within a View. In today’s article, we will be discussing how to do this.
In such cases, you can create a nested view by combining common columns as in the command below.
1 2 3 4 5 6 7 8 | CREATE VIEW public.actorfilmm AS SELECT fa.film_id,a.first_name, a.last_name, fi.title FROM actor a JOIN film_actor fa ON a.actor_id = fa.actor_id JOIN film fi ON fi.film_id = fa.film_id; |
We add our actorfilmm view to our query, which allows us to find the categories formed by joining the film_category and category tables, and we create a new view named actorfilmcategori that gives the actor’s name, surname, film’s name, and category.
We created our view in View and saw the data in it by selecting.