PostgreSQL sample database

In this article, we will see how to download and restore PostgreSQL sample database in PostgreSQL server. We can use PostgreSQL sample database for learning and practice PostgreSQL. We will use the DVD rental database for demonstrating the features of PostgreSQL.

The DVD rental database has many objects including tables, views, trigger, functions, sequences and domain.

Download the PostgreSQL Sample database

In this article, we will download and restore the downloaded PostgreSQL sample database.

1. Download PostgreSQL sample database on Windows just paste below link on your browser and press enter.

dvdrental

2. On Linux/Mac run the below command.

wget https://www.postgresql.r2schools.com/dvdrental

Load the sample database in PostgreSQL

1. The database file is in zip format ( dvdrental.zip) so we need to extract it to dvdrental.tar before loading the sample database into the PostgreSQL database server.

2. Create database and load the database using pg_restore tool.

We have explained in How to download and restore PostgreSQL sample database