Dominion Akinrotimi
Back to Projects
SQLPostgreSQLJoinsSubqueries

DVD Rental Business Questions in SQL

The task: a DVD rental chain with two stores wants answers about customers, stock, films and profit. The data sits in a 15-table relational database.

What I did: wrote 17 PostgreSQL queries, one per question, as part of the DigiGirls data programme.

View the code on GitHub

Questions answered

Sample: films that have never been rented

SELECT f.title
FROM film AS f
LEFT JOIN inventory AS i ON f.film_id = i.film_id
LEFT JOIN rental AS r ON r.inventory_id = i.inventory_id
WHERE r.inventory_id IS NULL;

The left joins keep every film, and the IS NULL filter keeps only those with no rental record. That includes films the stores don't stock at all.

Skills

Have data you cannot make sense of yet?

I turn raw data into dashboards, reports and decisions your team can act on.