🧠 PostgreSQL for Those Who Have No Idea!
A real journey from zero to creating your first database — with real logs and beginner mistakes.
“I had no idea how to run PostgreSQL.
I thought, 'Maybe I’ll just install it and it’ll work!'
But once I opened Git Bash, that’s when the real story began…”
💭 The Beginning
Imagine you’re totally new. You’ve just heard — “PostgreSQL is a powerful database.” You install it, but now you’re stuck. How do you actually run this thing?
You type:
psql --version
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
And PostgreSQL replies:
psql ( PostgreSQL) 16.6
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Nice! 😍
It’s installed. You feel like a genius already.
But then you try:
psql -U postgres
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
And suddenly...
password authentication failed for user "postgres"
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
😬 Uh oh — first roadblock!
🪄 Step 1: Learning from Mistakes
You guess — maybe the password was admin (lol).
You try again:
psql -U postgres
Password for user postgres:
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
And this time… 🎉
psql (16.6)
Type "help" for help.
postgres=#
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
You’re in!
Welcome to the PostgreSQL shell 🚀
(Feels a little like hacking in a movie, right?)
🧱 Step 2: What’s Inside This Thing?
Let’s check what databases exist:
\ l
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
PostgreSQL says:
postgres | template0 | template1
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
So it’s totally empty — a clean slate!
🏦 Step 3: Creating Your First Database
Let’s build your first database — a simple bank 💰
CREATE DATABASE bank ;
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
PostgreSQL replies:
CREATE DATABASE
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Now connect to it:
\ c bank
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Prompt changes:
bank=#
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
You’re inside your own database now 😎
🧩 Step 4: Creating Your First Table (and Your First Error!)
You try:
CREATE TABLE user ( id SERIAL PRIMARY KEY , name VARCHAR ( 50 ), balance INT );
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
But PostgreSQL screams:
ERROR: syntax error at or near "user"
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Oops! 😅
Because “user” is a reserved keyword in PostgreSQL.
🧱 Step 5: Renaming the Table and Succeeding
So you fix it:
CREATE TABLE bank_user (
id SERIAL PRIMARY KEY ,
name VARCHAR ( 50 ),
balance INT
);
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
This time it works perfectly 🎉
CREATE TABLE
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Check your tables:
\ dt
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Output:
public | bank_user | table | postgres
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
You did it! ✅
💰 Step 6: Inserting Your First Data
Now add a few users:
INSERT INTO bank_user ( name , balance )
VALUES
( 'Sajjad' , 5000 ),
( 'Samina' , 8000 ),
( 'Tanvir' , 3000 );
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
PostgreSQL replies:
INSERT 0 3
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
View your data:
SELECT * FROM bank_user ;
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Output:
id | name | balance
----+--------+---------
1 | Sajjad | 5000
2 | Samina | 8000
3 | Tanvir | 3000
(3 rows)
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
💸 Your first mini-bank database is alive!
🔍 Step 7: Exploring the Table
See table structure:
\ d bank_user
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Output:
Column | Type | Nullable | Default
--------+------+-----------+-----------------------
id | int | not null | nextval(...)
name | varchar(50)
balance | int
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
You’re officially a database architect now 😎
⚙️ Step 8: Let’s Play Around
Want to increase Sajjad’s balance?
UPDATE bank_user SET balance = balance + 2000 WHERE name = 'Sajjad' ;
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
Want to delete Tanvir’s account?
DELETE FROM bank_user WHERE name = 'Tanvir' ;
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
⭐ Must Read: sajjadrahman/a beginners journey with postgresql iif - Fox News Update
💬 So Why Learn PostgreSQL?
Because PostgreSQL isn’t just a database —
it’s a way to speak with data.
Learning SQL feels like learning the language that runs the internet.
It’s how every app, website, and system quietly works under the hood.
🧠 Quick Recap
What you did
Command
See databases
\l
Connect to a DB
\c bank
Create table
CREATE TABLE bank_user(...);
See tables
\dt
Insert data
INSERT INTO bank_user ...
View data
SELECT * FROM bank_user;
View structure
\d bank_user
Quit
\q
🌐 Let’s Connect!
If you found this guide helpful, I’d love to hear from you!
Follow or reach out to me on social media 👇
🐙 GitHub – Check out my projects & experiments
💼 LinkedIn – Let’s grow our dev network
🎥 YouTube – Watch tutorials & dev tips
🐦 X (Twitter) – Follow for quick updates & threads
💬 Feel free to comment, share, or drop a question — I’d love to connect with fellow learners and builders!
Top comments (0)