PostgreSQL pgAdmin 4
🐘 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.
1️⃣ 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.
2️⃣ 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
3️⃣ pgAdmin 4 vs psql ⭐
| Feature | pgAdmin 4 | psql |
|---|---|---|
| Interface | GUI | Command-line |
| Ease of use | Very easy | Medium |
| Best for | Beginners, admins | Developers, scripting |
| Visualization | ✔ Yes | ❌ No |
4️⃣ 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

5️⃣ Connect to PostgreSQL Server ⭐

Steps:
-
Open pgAdmin 4
-
Right-click Servers
-
Click Register → Server
-
Fill details:
General Tab
-
Name:
Local PostgreSQL
Connection Tab
-
Host:
localhost -
Port:
5432 -
Username:
postgres -
Password: (your DB password)
Click 👉 Save
6️⃣ pgAdmin 4 Interface Overview ⭐
Left Panel (Browser Tree)
-
Servers
-
Databases
-
Schemas
-
Tables
-
Views
-
Functions
Right Panel
-
Dashboard
-
Properties
-
SQL
-
Statistics
7️⃣ Create a Database in pgAdmin 4 ⭐

-
Expand Servers → Databases
-
Right-click → Create → Database
-
Enter:
-
Database name
-
Owner
-
-
Click Save
8️⃣ Create Table Using Query Tool ⭐

-
Select Database
-
Click Query Tool
-
Write SQL:
-
Click ▶ Execute
9️⃣ 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
1️⃣1️⃣ 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
