PostgreSQL is a powerful, open-source relational database known for standards compliance and advanced features like JSON columns and full-text search.

What is PostgreSQL?

It's a general-purpose SQL database used by everything from small side projects to large-scale production systems.

Installation

bash
# macOS (Homebrew)
brew install postgresql

# Ubuntu/Debian
sudo apt install postgresql

Creating a Table

sql
CREATE TABLE articles (
  id SERIAL PRIMARY KEY,
  title VARCHAR(200) NOT NULL,
  published_at TIMESTAMP DEFAULT NOW()
);

Basic CRUD Queries

sql
INSERT INTO articles (title) VALUES ('Learning SQL');

SELECT * FROM articles WHERE id = 1;

UPDATE articles SET title = 'Learning SQL Well' WHERE id = 1;

DELETE FROM articles WHERE id = 1;
PostgreSQLSQLDatabases