Skip to main content

public.rental_by_category

Description

Table Definition
CREATE MATERIALIZED VIEW rental_by_category AS (
SELECT c.name AS category,
sum(p.amount) AS total_sales
FROM (((((payment p
JOIN rental r ON ((p.rental_id = r.rental_id)))
JOIN inventory i ON ((r.inventory_id = i.inventory_id)))
JOIN film f ON ((i.film_id = f.film_id)))
JOIN film_category fc ON ((f.film_id = fc.film_id)))
JOIN category c ON ((fc.category_id = c.category_id)))
GROUP BY c.name
ORDER BY (sum(p.amount)) DESC
)

Referenced Tables

Columns

NameTypeDefaultNullableChildrenParentsComment
categorytexttrue
total_salesnumerictrue

Indexes

NameDefinition
rental_categoryCREATE UNIQUE INDEX rental_category ON public.rental_by_category USING btree (category)

Relations

er