DVD Rental Database
Last updated
Last updated
https://github.com/syedjaferk/postgres_sample_database/blob/main/dvd_rental/dvdrental.tar
Download the tar file from the given link.
Create the dvdrental database. Login to the postgres db, with the user. (here for example we are using the postgres superuser.)
After entering the password correctly, you will be connected to the PostgreSQL server.
Second, create a new database called dvdrental
using CREATE DABASE
statement:
Output:
PostgreSQL will create a new database called dvdrental
.
Third, verify the database creation using the \l
command. The \l
command will show all databases in the PostgreSQL server. The output shows that dvdrental
on the list, meaning that you have created the dvdrental
database successfully. Now disconnect from the PostgreSQL server and exit the psql
using the exit
command
Load the dataset into the db using the pg_restore
n this command:
The -U postgres
instructs pg_restore
to connect the PostgreSQL server using the postgres
user.
The -d dvdrental
specifies the target database to load.
It might prompt you to enter the password for the postgres
user. Enter the password for the postgres
user and press the Enter (or Return key)
It’ll take about seconds to load data stored in the dvdrental.tar
file into the dvdrental
database.
Verify the database is loaded.
Login to the postgres with database as dvdrental
,
display all tables in the dvdrental
database
Now you have the practice DB. Happy Learning !