Video summary
PostgreSQL Full course 2026 | Learn PostgreSQL in One Video
Main summary
Key takeaways
Main ideas / lessons (what the video teaches)
-
Purpose of the course
- A practical PostgreSQL foundation intended to help beginners build real database skills via SQL files and running them in the terminal/
psql. - It’s a prerequisite for an upcoming Node.js Masterclass; Postgres concepts will also be covered later there.
- A practical PostgreSQL foundation intended to help beginners build real database skills via SQL files and running them in the terminal/
-
Curriculum structure (3 sections)
- Part 1: Foundations
- Create databases, schemas, tables, and define data types
- Concepts like constants/constraints and primary keys
- Part 2: Queries & data operations
- Insert, select, filtering, pattern matching, handling NULLs
- Ordering, limiting, offset/pagination
- Updating single/multiple rows, and
RETURNINGafter INSERT
- Part 3: Relationships & advanced SQL
- Foreign keys, one-to-many, many-to-many (junction table)
- INNER JOIN and LEFT JOIN
- Aggregations: aggregate functions,
GROUP BY,COUNT DISTINCT - Subqueries, indexes, and transactions
- Part 1: Foundations
-
Learning approach
- The instructor emphasizes this is not purely conceptual:
- Each concept is written into its own
.sqlfile - The learner runs the file (and sometimes uses interactive commands in
psql) to verify results.
- Each concept is written into its own
- The instructor emphasizes this is not purely conceptual:
Methodology / workflow presented in the video
1) Setup & tools
- Install PostgreSQL and pgAdmin 4 (and related components).
- Use pgAdmin visually for exploration (tables/schemas), but the course emphasizes mastering command line.
- Use
psqlfor terminal-based interaction with PostgreSQL:- Run SQL files with:
psql -U <user> -d <database> -f <file.sql>
- Connect interactively to execute:
- queries
- meta-commands (e.g., list databases/tables)
- SQL directly
- Run SQL files with:
2) Recommended folder/file structure
- Create folders for sequential learning:
part 1(basic DB objects + constraints + primary keys)part 2(SQL queries and operations)- (Part 3 comes later in the course)
- Inside each part, create numbered SQL files like:
01_first_database.sql02_first_schema.sql03_first_table.sql- etc.
3) Part 1: SQL foundations (core steps)
Create database
- Learn:
CREATE DATABASE ...- (For learning only)
DROP DATABASE IF EXISTS ...
- Connect to the new DB using
psql.
Create schema
- Learn:
CREATE SCHEMA IF NOT EXISTS <schema_name>- Install extensions when needed, e.g.:
CREATE EXTENSION IF NOT EXISTS pgcrypto(for UUID generation)
- Use system catalogs to inspect schemas:
- Query
information_schema.schematato list available schemas.
- Query
Create tables
- Learn:
CREATE TABLE <schema>.<table> ( ...column definitions... )- Dropping tables (learning):
DROP TABLE IF EXISTS ...
- Column-level concepts emphasized:
- serial primary key (auto-increment integer)
NOT NULLUNIQUECHECKconstraintsDEFAULTvaluestimestamp/now()defaults for created time
Insert and read data
- Insert:
INSERT INTO <table>(cols...) VALUES (...);
- Read:
SELECT * FROM <table>SELECT cols... FROM <table>
Data types overview
- Integer types:
integer,bigint - Strings:
text,varchar(n) - Currency/precision:
numeric(p,s) - Booleans:
boolean - UUID & JSON:
uuidwith defaultgen_random_uuid()jsonbfor structured metadata
- JSON field extraction:
- Access JSONB value (example uses
metadata->>'browser'-style logic).
- Access JSONB value (example uses
NULL vs empty string vs zero
- Teach distinctions:
NULL= missing/unknown value''(empty string) = known value but empty text0= actual numeric zero
- Filtering rules:
- Use
IS NULLandIS NOT NULL(not= NULL)
- Use
Constraints (“constants”) and why they matter
- Emphasis:
- Database constraints are stronger than application-level validation
- Constraints ensure invalid writes fail even if bypassing app logic.
- Demonstrated with:
NOT NULLviolationsUNIQUEviolationsCHECKconstraints (e.g., age >= 18)- DEFAULT handling when a value is omitted
Primary key behavior
- Primary key uniquely identifies rows.
- Demonstrated:
- Duplicate primary key insert fails with a uniqueness/primary key violation.
Part 2: SQL concepts & operations (detailed list of instructions)
Core setup used for query practice
- A “base” setup file creates a products table used across query examples.
- Uses constraints like:
- UUID PK
- NOT NULL columns
- CHECK constraints for price/stock ranges
- UNIQUE SKU
- defaults (e.g.,
is_active= true)
A) Insert
- Insert a single row
INSERT INTO products(col1, col2, ...) VALUES(val1, val2, ...);
- Notes:
- Some columns can use defaults (e.g.,
is_active). - Attempting to insert duplicate UNIQUE values (SKU) fails.
- Some columns can use defaults (e.g.,
- Insert multiple rows
INSERT INTO products(col1, ...) VALUES (v1,...), (v2,...), ...;
B) Select
- Select star vs select specific columns
SELECT * FROM products;SELECT name, price, ... FROM products;
- Column aliases
SELECT name AS product_name, price AS selling_price, stock AS available_quantity FROM products;
C) Filtering
WHEREclauseWHERE category = 'electronics'WHERE price > 1000WHERE is_active = false
- AND / OR / NOT
AND: both conditions must be trueOR: at least one condition must be trueNOT: invert/exclude a condition- Parentheses used for complex logic.
- Pattern matching
LIKE: case-sensitiveILIKE: case-insensitive- Wildcards:
%= any number of characters_= exactly one character
IN/NOT IN/BETWEENWHERE category IN ('electronics','furniture')WHERE category NOT IN (...)WHERE price BETWEEN 100 AND 2000(inclusive)
- NULL filtering
WHERE description IS NULLWHERE description IS NOT NULL
D) Sorting: ORDER BY
- Ascending/descending:
ORDER BY price ASCORDER BY price DESC
- Multiple-column sorting:
ORDER BY category ASC, price DESC
E) Pagination with LIMIT and OFFSET
- Definitions:
LIMIT n= return at mostnrowsOFFSET m= skip the firstmrows
- Example pattern:
- Page 1:
... ORDER BY ... LIMIT 5 OFFSET 0 - Page 2:
... ORDER BY ... LIMIT 5 OFFSET 5
- Page 1:
- Pagination formula:
offset = (page_number - 1) * limit
F) Updating rows
- Update a single row
UPDATE products SET price = ..., stock = ... WHERE sku = ...;
- Update multiple rows
UPDATE products SET price = ROUND(price * 1.10, 2) WHERE category = 'stationery';- Also demonstrated:
SET is_active = false WHERE stock = 0
G) Deleting rows
- Delete with a condition:
DELETE FROM products WHERE sku = ...;
- Demonstrated “check before/delete/verify after” pattern.
H) RETURNING (after INSERT/UPDATE/DELETE)
RETURNINGreturns affected rows immediately after a write.- Examples described:
- After INSERT:
- return id/name/category/price/stock/created_at
- After UPDATE:
- return updated fields
- After DELETE:
- return deleted row identifiers/fields
- After INSERT:
Part 3: Relationships & advanced SQL (core concepts covered)
1) Seed data and relational schema
- Creates and seeds multiple related tables:
usersposts(referencesusers.idviauser_id)comments(referencesposts.idviapost_id)tags(unique tag names)post_tagsjunction table for many-to-many:- composite primary key
(post_id, tag_id) - references
postsandtags
- composite primary key
2) Foreign keys
- Definition:
- A foreign key column points to a primary key in another table.
- Example taught:
posts.user_idreferencesusers.id
- Conceptual requirement:
- Posts must belong to existing users.
3) One-to-many relationship
- Definition:
- One parent row (user) can have many child rows (posts).
- Query concept shown:
- Display post with author name by joining:
users.id = posts.user_id
- Display post with author name by joining:
4) INNER JOIN
- Meaning:
- Returns only matching rows from both sides.
- Example:
- Join
poststousersto show only posts whose author matches - Apply filtering such as
posts.status = 'published'
- Join
5) LEFT JOIN
- Meaning:
- Keeps all rows from the left table
- If no match exists in the right table, right-side columns become NULL
- Example:
- Show all posts plus their comments if present; posts with no comments appear with
NULLcomment body.
- Show all posts plus their comments if present; posts with no comments appear with
6) Many-to-many relationship
- Definition:
- Use a junction table (
post_tags) to connect:- one post ↔ many tags
- one tag ↔ many posts
- Use a junction table (
- Example query concept:
- Show each post with its tag name by joining:
posts→post_tags→tags
- Show each post with its tag name by joining:
7) Table aliases
- Benefit:
- Makes join queries shorter and easier to read.
- Concept:
- Alias tables and reference columns using alias prefixes (e.g.,
p.title,u.name,c.body).
- Alias tables and reference columns using alias prefixes (e.g.,
8) Aggregate functions
- Examples:
COUNT,SUM,AVG,MIN,MAX
- Used with grouping/filtering to produce analytics-style results.
9) GROUP BY and HAVING
GROUP BY:- creates groups of rows
HAVING:- filters groups after aggregation (unlike
WHERE, which filters rows before grouping)
- filters groups after aggregation (unlike
- Example:
- Authors who wrote at least two posts:
- join users/posts
GROUP BY userHAVING COUNT(post.id) >= 2
- Authors who wrote at least two posts:
10) COUNT DISTINCT
- Purpose:
- Count unique values when joins create repeated rows.
- Example:
- Count unique posts connected to each tag.
11) Subqueries
- Definition:
- Nested query where the inner query runs first.
- Example concept:
- “Posts with views greater than the average views.”
12) Indexes (conceptual coverage + examples)
- Definition:
- Indexes help Postgres find rows faster.
- Taught use cases:
- Index on filtering column (e.g.,
status) - Composite index for filter + sort (e.g.,
(status, views DESC)) - Indexing foreign key columns (e.g.,
posts.user_id) to speed lookups by parent.
- Index on filtering column (e.g.,
13) Transactions
- Definition:
- Run multiple SQL statements as a single atomic unit.
- Either all succeed and are saved, or failures can undo changes (rollback concept).
- Steps taught:
BEGIN- run multiple updates
COMMITto permanently save changes
- Motivation example:
- E-commerce order process: update stock, create order/payment records—must stay consistent.
Speakers / sources featured
- Speaker: Unspecified instructor (narrator/teacher who installs tools, explains SQL, and demonstrates commands).