Course page
Log in

You are watching a free preview. Enroll to open all 24 lessons, track progress and ask the course tutor.

Enroll for $69.99

Section 1: Getting started with PostgreSQL

Why PostgreSQL

Video 8 min Lesson 1 of 24 Sample clip Preview

There are many databases to choose from, but PostgreSQL has become a default choice for a large share of new applications. Understanding why helps you appreciate what you are learning.

What PostgreSQL is

PostgreSQL, often called Postgres, is an open source relational database. It stores data in tables of rows and columns, enforces relationships and rules between them, and lets you query data with SQL. It has been developed in the open for decades and is released under a permissive licence, so you can use it freely in commercial projects.

Why teams choose it

  • Reliability: it is designed so that committed data is not lost, with careful transaction handling and write ahead logging.
  • Standards and features: strong support for the SQL standard plus extras such as JSONB documents, arrays, full text search, window functions and powerful indexing.
  • Extensibility: extensions add capabilities, for example PostGIS for geographic data or pgvector for vector similarity search.
  • Ecosystem: managed PostgreSQL services exist on all major cloud providers, and almost every programming language and framework supports it.
  • Community: extensive documentation, which is among the best of any open source project, and an active community.

Relational thinking

In a relational database, you store each kind of thing in its own table and connect tables with keys. In our bookshop:

  • A customers table holds one row per customer.
  • A books table holds one row per book.
  • An orders table holds one row per order, with a reference to the customer.
  • An order_items table holds one row per book in an order, referencing both the order and the book.

This structure avoids repeating information, keeps data consistent and lets you answer questions you did not plan for, such as "which authors sell best in December?", with a query.

SQL in one sentence

SQL is a declarative language: you describe what result you want, and the database works out how to get it. For example:

SELECT title, price
FROM books
WHERE price < 20
ORDER BY price;

You do not tell PostgreSQL how to search the table. Its query planner chooses a strategy, and later in the course you will learn to read those strategies with EXPLAIN.

What you need

In the next lesson, you will install PostgreSQL. You can use Docker, which keeps your system clean, or the native installers for Windows and macOS, or your Linux distribution's packages. All work equally well for this course.

← → switch lessons