This project is designed as a practical learning tool and a quick revision guide for anyone looking to master PostgreSQL. Created for personal revision and open to anyone who finds it useful.
Note: This repository is still a work in progress. More topics, examples and advanced concepts will be added over time!
- Basic understanding of what a database is
- PostgreSQL 14+ installed (Download)
- A client to run queries:
psql(CLI), pgAdmin, DBeaver, or a VS Code extension like PostgreSQL Client
Each folder covers a topic. Files inside are numbered in the order you should follow them.
# Clone the repo
git clone https://github.com/nbakh16/postgresql-quick-ref.git
cd postgresql-quick-ref
# Run any file directly with psql- Every file is independent. Go through any topic as needed.
- Run every file yourself — don't just read, execute and observe the output.
- Modify the examples — change values, break things, and see what happens.
- Check the comments — explained edge cases and exceptions, not just syntax.
| # | Topic | What You'll Learn |
|---|---|---|
| 01 | Basics | Create/drop databases & tables, data types |
| 02 | CRUD Operations | INSERT, SELECT, UPDATE, DELETE |
| 03 | Querying | WHERE, ORDER BY, LIMIT, aggregate functions, GROUP BY |
| 04 | String and DateTime formatting | String, Date & Time Formatting & Manipulation |
| ** | ..... | New topics will be added soon! |
Every file in this repo follows this pattern so it's easy to read and re-run:
-- ============================================
-- Topic: <Topic Name>
-- Description: <What this file demonstrates>
-- ============================================
-- Setup: create any tables needed
-- ...
-- Main examples with explanatory comments
-- ...
-- Cleanup comments where necessary
-- DROP TABLE ...;Found an error? Have a better example? PRs are welcome.
- Fork the repo
- Create a branch:
git checkout -b add/topic-name - Follow the existing file structure and comment style
- Open a pull request with a short description
- PostgreSQL Official Docs
- PostgreSQL Tutorial
- Use The Index, Luke (indexing deep dive)
- pgExercises (practice problems)
This project is licensed under the MIT License.