The dvdrental database is more than just a list of movies; it is a sophisticated, relational data model that captures the complexity of a small-to-medium business. Its enduring popularity in SQL education stems from its ability to scale from basic SELECT statements to complex, business-critical analytics, making it an indispensable tool for anyone looking to master PostgreSQL.
Analyze data by calculating metrics such as total payments per customer or average rental duration. dvdrental
The Architecture of a Digital Relic: An Analysis of the DVD Rental Database The dvdrental database is more than just a
The dvdrental database is a conceptual simulation of a physical DVD rental store's information system. It is modeled after a real-world scenario, containing data about films, actors, customers, rentals, payments, and store locations. The Architecture of a Digital Relic: An Analysis
CREATE OR REPLACE VIEW overdue_rentals AS SELECT r.rental_id, c.customer_id, c.first_name, c.last_name, c.email, f.title AS film_title, r.rental_date, r.return_date, CURRENT_DATE - r.rental_date::DATE AS days_rented, f.rental_duration, CASE WHEN r.return_date IS NULL AND (CURRENT_DATE - r.rental_date::DATE) > f.rental_duration THEN (CURRENT_DATE - r.rental_date::DATE) - f.rental_duration ELSE 0 END AS days_overdue FROM rental r JOIN customer c ON r.customer_id = c.customer_id JOIN inventory i ON r.inventory_id = i.inventory_id JOIN film f ON i.film_id = f.film_id WHERE r.return_date IS NULL AND (CURRENT_DATE - r.rental_date::DATE) > f.rental_duration;