How to download and restore PostgreSQL sample database

In this article, we will see how to download and restore PostgreSQL sample database. We can restore sample database in PostgreSQL server using following methods.

1. Using psql tool on windows.
2. Using Terminal on Linux.

First we have to download PostgreSQL sample database. Go through Download PostgreSQL Sample database

Restore PostgreSQL sample database on windows by using psql utility

Continue reading How to download and restore PostgreSQL sample database

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

Continue reading PostgreSQL sample database

How to take backup and restore table in PostgreSQL

In this article, we are going to how to take backup and restore table in PostgreSQL. We use pg_dump to take backup of table wiht –table option and psql or pg_restore tools are used to restore the table using existing backup.

1. Syntax to backup table data:

pg_dump -Fc --data-only -h -p -U -W -d -t

> /path_and_filename_forbackup

Continue reading How to take backup and restore table in PostgreSQL

How to take backup of a table(s) in PostgreSQL

In this article, we will see how to take backup of a table(s) in PostgreSQL. We can take the backup of single or multiple tables using pg_dump command with –table or -t option.

Syntax to take backup of table(s) in PostgreSQL:

Following syntax is used to take backup of table with table definition:

pg_dump -d databasename --table=yourTable --column-inserts > file_name.sql

Continue reading How to take backup of a table(s) in PostgreSQL