🧠 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 And PostgreSQL replies:
psql (PostgreSQL) 16.6 Nice! 😍
It’s installed. You feel like a genius already.
But then you try:
psql -U postgres And suddenly...
password authentication failed for user "postgres" 😬 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: And this time… 🎉
psql (16.6) Type "help" for help. postgres=# 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 PostgreSQL says:
postgres | template0 | template1 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; PostgreSQL replies:
CREATE DATABASE Now connect to it:
\c bank Prompt changes:
bank=# 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); But PostgreSQL screams:
ERROR: syntax error at or near "user" 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 ); This time it works perfectly 🎉
CREATE TABLE Check your tables:
\dt Output:
public | bank_user | table | postgres 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); PostgreSQL replies:
INSERT 0 3 View your data:
SELECT * FROM bank_user; Output:
id | name | balance ----+--------+--------- 1 | Sajjad | 5000 2 | Samina | 8000 3 | Tanvir | 3000 (3 rows) 💸 Your first mini-bank database is alive!
🔍 Step 7: Exploring the Table
See table structure:
\d bank_user Output:
Column | Type | Nullable | Default --------+------+-----------+----------------------- id | int | not null | nextval(...) name | varchar(50) balance | int 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'; Want to delete Tanvir’s account?
DELETE FROM bank_user WHERE name = 'Tanvir'; 💬 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)