How to execute sql or script file in PostgreSQL on Windows and Linux

In this article, you will learn how to execute sql or script file in PostgreSQL on Windows and Linux step by step.

Create and Execute script in POstgreSQL on Linux Environment:

On Linux, We can execute scripts files in two ways:

1. From Linux shell
2. From psql shell

Execute PostgreSQL sql script from Linux shell:
Continue reading How to execute sql or script file in PostgreSQL on Windows and Linux

How to execute .sql file in PostgreSQL

In this tutorial, we will see how to execute .sql file in PostgreSQL. We can execute/run .sql or script file from following methods.

1. From the Linux shell
2. From the psql tool

Syntax to execute .sql file in PostgreSQL:

psql -h hostname -d database_name -U user_name -p 5432 -a -q -f filepath

Continue reading How to execute .sql file in PostgreSQL