Skip to main content

PostgreSQL

PostgreSQL is a powerful open-source relational database.

What Is PostgreSQL

PostgreSQL stores structured data in tables and supports SQL, transactions, indexes, constraints, views, stored procedures, JSON data, and extensions.

It is commonly used for production web applications, analytics systems, internal tools, and data-heavy products.

How To Use PostgreSQL

Install PostgreSQL locally or use a hosted provider. Create a database, define tables, and query data with SQL.

Applications usually connect through a database driver, ORM, or query builder.

Basic Example

CREATE TABLE users (
id serial PRIMARY KEY,
name text NOT NULL,
email text UNIQUE NOT NULL
);

INSERT INTO users (name, email)
VALUES ('Tiew', 'tiew@example.com');

SELECT id, name, email FROM users;

Common Concepts

  • Tables store rows and columns.
  • Primary keys uniquely identify rows.
  • Indexes speed up lookups.
  • Transactions group changes safely.

What To Learn Next

Learn joins, indexes, constraints, migrations, backups, query plans, JSONB, and full-text search.