Learn/Glossary/PostgreSQL
Databases

PostgreSQL

PostgreSQL is a highly reliable relational database that stores data in structured tables and queries it using SQL.

Diagram

  PostgreSQL Table Structure:
  Table: Users
  ┌──────┬──────────────┬──────────────────┐
  │  id  │  name        │  email           │
  ├──────┼──────────────┼──────────────────┤
  │  1   │  Rohan       │  rohan@test.com  │
  │  2   │  Priya       │  priya@test.com  │
  └──────┴──────────────┴──────────────────┘

In Depth

PostgreSQL (Postgres) is an open-source, relational database management system. It stores data in rows and columns across linked tables, enforcing strict data types and structural integrity.

Code Example

SQL table structure and relational join

-- Create a table with relationships
CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  title VARCHAR(100),
  author_id INT REFERENCES users(id) ON DELETE CASCADE
);

-- Join table query
SELECT p.title, u.name
FROM posts p
JOIN users u ON p.author_id = u.id;

Related Terms