🏠 Home / Hub 🏠 Back to Hub

🐘 PostgreSQL

Advanced Relational Database | MySQL ထက် powerful, production-grade

01

Intro & Setup

PostgreSQL vs MySQL, install, psql CLI, pgAdmin

02

Tables & Data Types

CREATE TABLE, PG types, constraints, sequences

03

Queries & Joins

SELECT, WHERE, JOINs, LIMIT, OFFSET, ORDER BY

04

Functions & Aggregates

Built-in functions, GROUP BY, HAVING, subqueries

05

Indexes & Transactions

CREATE INDEX, EXPLAIN, BEGIN/COMMIT/ROLLBACK

06

Node.js + pg

node-postgres, pool, queries, prepared statements

07

Stored Procedures & Functions

PL/pgSQL, CREATE FUNCTION, CREATE PROCEDURE, loops, exception handling

08

Triggers & Audit Logs

BEFORE/AFTER triggers, auto-timestamps, audit log table, data validation

Prerequisites: SQL basics (sql_01 - sql_06) + Node.js အသိနည်းနည်း
Setup: postgresql.org → download → pgAdmin GUI tool ပါမယ်
Cloud: Supabase.com = Free PostgreSQL in cloud (easy setup)

⚡ PostgreSQL vs MySQL Key Differences

Feature          PostgreSQL              MySQL
-----------      ---------------         ---------------
License          Open Source (BSD)       Open Source + Oracle
JSON support     JSONB (fast, indexed)   JSON (basic)
Full text        Built-in tsvector       Requires config
Arrays           Native ARRAY type       Not native
Window functions Yes (advanced analytics) Limited
Sequences        SERIAL / BIGSERIAL      AUTO_INCREMENT
Case sensitive   "TableName" matters     tablename = TABLENAME
Default port     5432                    3306

-- PostgreSQL syntax sample
SELECT u.name, COUNT(o.id) AS orders
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
GROUP BY u.name
HAVING COUNT(o.id) > 5
ORDER BY orders DESC
LIMIT 10;

📌 Study Checklist