← All schemas
Schema Library

DVD Rental Database ER Diagram

The DVD Rental database is the PostgreSQL tutorial's sample schema: a DVD store where films are stocked as inventory per store, customers rent inventory, staff process rentals, and payments record each charge. Fifteen tables are mapped above, from actor and category through film, inventory, rental, payment, and the staff/store geography chain. One detail worth knowing: the tutorial dump is a simplified variant - the store relationships (customer, inventory, and staff each belong to a store) exist as columns but carry no foreign-key constraints in the file, so they are restored here to match the official ER diagram.

Written by Varun Krishnan · Founder, dbdiagramr

Published · Updated

Source: DVD Rental dump b54cb675 (neondatabase/postgres-sample-dbs); original database from postgresqltutorial.com · License: MIT for Neon scripts; original database terms not stated

Tables
15
Core flow
Film -> Inventory -> Rental -> Payment
Dump commit
b54cb675

Neon plain-SQL DVD Rental dump b54cb67534bf, committed 2025-12-22.

The dump omits three store foreign keys; they are restored from the official ER diagram. Views, functions, and procedural objects are omitted. dvdrental.sql.

DVD Rental database schema diagram showing every table, column, and foreign key

Scroll horizontally to see the full diagram. Click it to open at full size.

Open in DBdiagramr to edit →

Embed this diagram

Paste this HTML into a README, docs page, or blog post. The image links back to the full schema page.

<a href="https://www.dbdiagramr.space/schema/dvd-rental">
  <img src="https://www.dbdiagramr.space/schemas/dvd-rental-er-diagram.svg" alt="DVD Rental Database ER Diagram (PostgreSQL)" width="2743" height="1474" />
</a>
<p><a href="https://www.dbdiagramr.space/schema/dvd-rental">DVD Rental Database ER Diagram (PostgreSQL)</a> by dbdiagramr</p>

Tables in the DVD Rental schema

ColumnTypeNullableKey
customer
customer_idintegerNoPK
store_idsmallintNoFK → store.store_id
first_namecharacter varying(45)No-
last_namecharacter varying(45)No-
emailcharacter varying(50)Yes-
address_idsmallintNoFK → address.address_id
activeboolbooleanNo-
create_datedateNo-
last_updatetimestamp without time zoneYes-
activeintegerYes-
actor
actor_idintegerNoPK
first_namecharacter varying(45)No-
last_namecharacter varying(45)No-
last_updatetimestamp without time zoneNo-
category
category_idintegerNoPK
namecharacter varying(25)No-
last_updatetimestamp without time zoneNo-
film
film_idintegerNoPK
titlecharacter varying(255)No-
descriptiontextYes-
release_yearpublic.yearYes-
language_idsmallintNoFK → language.language_id
rental_durationsmallintNo-
rental_ratenumeric(4,2)No-
lengthsmallintYes-
replacement_costnumeric(5,2)No-
ratingpublic.mpaa_ratingYes-
last_updatetimestamp without time zoneNo-
special_featurestext[]Yes-
fulltexttsvectorNo-
film_actor
actor_idsmallintNoPK, FK → actor.actor_id
film_idsmallintNoPK, FK → film.film_id
last_updatetimestamp without time zoneNo-
film_category
film_idsmallintNoPK, FK → film.film_id
category_idsmallintNoPK, FK → category.category_id
last_updatetimestamp without time zoneNo-
address
address_idintegerNoPK
addresscharacter varying(50)No-
address2character varying(50)Yes-
districtcharacter varying(20)No-
city_idsmallintNoFK → city.city_id
postal_codecharacter varying(10)Yes-
phonecharacter varying(20)No-
last_updatetimestamp without time zoneNo-
city
city_idintegerNoPK
citycharacter varying(50)No-
country_idsmallintNoFK → country.country_id
last_updatetimestamp without time zoneNo-
country
country_idintegerNoPK
countrycharacter varying(50)No-
last_updatetimestamp without time zoneNo-
inventory
inventory_idintegerNoPK
film_idsmallintNoFK → film.film_id
store_idsmallintNoFK → store.store_id
last_updatetimestamp without time zoneNo-
language
language_idintegerNoPK
namecharacter(20)No-
last_updatetimestamp without time zoneNo-
payment
payment_idintegerNoPK
customer_idsmallintNoFK → customer.customer_id
staff_idsmallintNoFK → staff.staff_id
rental_idintegerNoFK → rental.rental_id
amountnumeric(5,2)No-
payment_datetimestamp without time zoneNo-
rental
rental_idintegerNoPK
rental_datetimestamp without time zoneNo-
inventory_idintegerNoFK → inventory.inventory_id
customer_idsmallintNoFK → customer.customer_id
return_datetimestamp without time zoneYes-
staff_idsmallintNoFK → staff.staff_id
last_updatetimestamp without time zoneNo-
staff
staff_idintegerNoPK
first_namecharacter varying(45)No-
last_namecharacter varying(45)No-
address_idsmallintNoFK → address.address_id
emailcharacter varying(50)Yes-
store_idsmallintNoFK → store.store_id
activebooleanNo-
usernamecharacter varying(16)No-
passwordcharacter varying(40)Yes-
last_updatetimestamp without time zoneNo-
picturebyteaYes-
store
store_idintegerNoPK
manager_staff_idsmallintNoFK → staff.staff_id
address_idsmallintNoFK → address.address_id
last_updatetimestamp without time zoneNo-

Table relationships

19 relationships connect the tables in this schema. Each entry shows the child columns, the parent columns they reference, and the cardinality.

One-to-many

customer.address_id → address.address_id

One address can have many customers (customer.address_id -> address.address_id, required).

One-to-many

customer.store_id → store.store_id

One store can have many customers (customer.store_id -> store.store_id, required).

One-to-many

film.language_id → language.language_id

One language can have many films (film.language_id -> language.language_id, required).

Many-to-many

film_actor (actor_id -> actor.actor_id, film_id -> film.film_id)

Many actors can have many films through film_actor (film_actor.actor_id -> actor.actor_id, film_actor.film_id -> film.film_id).

Many-to-many

film_category (category_id -> category.category_id, film_id -> film.film_id)

Many categories can have many films through film_category (film_category.category_id -> category.category_id, film_category.film_id -> film.film_id).

One-to-many

address.city_id → city.city_id

One city can have many addresses (address.city_id -> city.city_id, required).

One-to-many

city.country_id → country.country_id

One country can have many cities (city.country_id -> country.country_id, required).

One-to-many

inventory.film_id → film.film_id

One film can have many inventories (inventory.film_id -> film.film_id, required).

One-to-many

inventory.store_id → store.store_id

One store can have many inventories (inventory.store_id -> store.store_id, required).

One-to-many

payment.customer_id → customer.customer_id

One customer can have many payments (payment.customer_id -> customer.customer_id, required).

One-to-many

payment.rental_id → rental.rental_id

One rental can have many payments (payment.rental_id -> rental.rental_id, required).

One-to-many

payment.staff_id → staff.staff_id

One staff can have many payments (payment.staff_id -> staff.staff_id, required).

One-to-many

rental.customer_id → customer.customer_id

One customer can have many rentals (rental.customer_id -> customer.customer_id, required).

One-to-many

rental.inventory_id → inventory.inventory_id

One inventory can have many rentals (rental.inventory_id -> inventory.inventory_id, required).

One-to-many

rental.staff_id → staff.staff_id

One staff can have many rentals (rental.staff_id -> staff.staff_id, required).

One-to-many

staff.address_id → address.address_id

One address can have many staffs (staff.address_id -> address.address_id, required).

One-to-many

staff.store_id → store.store_id

One store can have many staffs (staff.store_id -> store.store_id, required).

One-to-many

store.address_id → address.address_id

One address can have many stores (store.address_id -> address.address_id, required).

One-to-many

store.manager_staff_id → staff.staff_id

One staff can have many stores (store.manager_staff_id -> staff.staff_id, required).

Common queries

These PostgreSQL queries run against the schema shown on this page.

Most rented films

Rank films by the number of rentals.

select f.title, count(r.rental_id) as rentals
from film f
join inventory i on i.film_id = f.film_id
join rental r on r.inventory_id = i.inventory_id
group by f.film_id, f.title
order by rentals desc, f.title;

Revenue by store

Sum payments by the staff member's store.

select s.store_id, sum(p.amount) as revenue
from payment p
join staff st on st.staff_id = p.staff_id
join store s on s.store_id = st.store_id
group by s.store_id
order by s.store_id;

Overdue rentals

Unreturned rentals older than seven days.

select c.first_name || ' ' || c.last_name as customer,
       f.title, r.rental_date
from rental r
join customer c on c.customer_id = r.customer_id
join inventory i on i.inventory_id = r.inventory_id
join film f on f.film_id = i.film_id
where r.return_date is null
  and r.rental_date < now() - interval '7 days'
order by r.rental_date;

Films per category

Count titles in each film category.

select c.name, count(fc.film_id) as films
from category c
left join film_category fc on fc.category_id = c.category_id
group by c.category_id, c.name
order by films desc, c.name;

Frequently asked questions

Related schema diagrams

Visualize your own database

Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.

Try it free →