PostgreSQL pgAdmin 4

PostgreSQL Tutorial

PostgreSQL pgAdmin 4 – Complete Guide

pgAdmin 4 is the official graphical user interface (GUI) tool for managing PostgreSQL databases.
It allows you to create databases, run SQL queries, manage tables, users, and view data without typing everything in the command line.


What is pgAdmin 4?

pgAdmin 4 is:

  • A web-based GUI tool

  • Used to administer PostgreSQL

  • Beginner-friendly alternative to psql

  • Installed along with PostgreSQL (by default)

 Think of pgAdmin as MySQL Workbench for PostgreSQL.


 Why Use pgAdmin 4?

  •  Easy-to-use graphical interface
  •  Run SQL queries visually
  •  Manage databases, tables, views
  • View & edit table data
  •  Suitable for beginners & professionals

 pgAdmin 4 vs psql

FeaturepgAdmin 4psql
InterfaceGUICommand-line
Ease of useVery easyMedium
Best forBeginners, adminsDevelopers, scripting
Visualization YesNo

 Opening pgAdmin 4

 

 

After installing PostgreSQL:

  • Windows → Start Menu → pgAdmin 4

  • macOS/Linux → Applications → pgAdmin 4

 First time:

  • Set master password

  • Used to store DB credentials securely

 


 Connect to PostgreSQL Server

 

Steps:

  1. Open pgAdmin 4

  2. Right-click Servers

  3. Click Register → Server

  4. Fill details:

General Tab

  • Name: Local PostgreSQL

Connection Tab

  • Host: localhost

  • Port: 5432

  • Username: postgres

  • Password: (your DB password)

Click   Save


 pgAdmin 4 Interface Overview

Left Panel (Browser Tree)

  • Servers

  • Databases

  • Schemas

  • Tables

  • Views

  • Functions

Right Panel

  • Dashboard

  • Properties

  • SQL

  • Statistics


Create a Database in pgAdmin 4

 

  1. Expand Servers → Databases

  2. Right-click → Create → Database

  3. Enter:

    • Database name

    • Owner

  4. Click Save


 Create Table Using Query Tool

 

  1. Select Database

  2. Click Query Tool

  3. Write SQL:

  1. Click ▶ Execute


Insert & View Data

To view data:

  • Right-click table → View/Edit Data → All Rows


 Query Tool in pgAdmin 4

The Query Tool lets you:

  • Run SELECT, INSERT, UPDATE, DELETE

  • See query execution time

  • Export results as CSV/Excel

 Very important for practice & interviews


Common pgAdmin 4 Errors

  •  Wrong password
  •  PostgreSQL service not running
  •  Wrong port (not 5432)
  •  Firewall blocking connection

 Fix: Check PostgreSQL service & credentials.


 Interview / Exam Questions

Q1. What is pgAdmin 4?
 GUI administration tool for PostgreSQL

Q2. Default PostgreSQL port?
5432

Q3. Is pgAdmin 4 mandatory?
 No, but highly recommended

Q4. Which tool is faster for scripting?
psql


Real-Life Use Cases

  •  Database administration
  •  Learning PostgreSQL
  • Writing & testing SQL queries
  •  Managing tables & users
  •  Data analysis & reporting

 Summary

  • pgAdmin 4 is the official PostgreSQL GUI

  • Makes database management easy

  • Best for beginners

  • Includes powerful Query Tool

  • Complements psql

  • Important for PostgreSQL learning & interviews

You may also like...