Most painful bugs in business software trace back to the database design: a customer with two addresses where the schema allowed one, totals that disagree because the same fact is stored twice, or an order that points to a product that no longer exists. This course teaches you to model a domain before writing code, turn that model into tables with the right keys and constraints, and change it safely once real data is in it.
What you'll learn
- Talking to stakeholders to find the entities, attributes and rules in a domain
- Drawing entity-relationship diagrams and reading other people's
- One-to-one, one-to-many and many-to-many relationships, and junction tables
- Primary keys: natural versus surrogate, integers versus UUIDs
- Foreign keys,
NOT NULL,UNIQUEandCHECKconstraints as business rules - Normalisation to third normal form, and when deliberate denormalisation is justified
- Common patterns: users and roles, orders and line items, addresses, soft deletes, audit history
- Modelling money, dates, time zones and Indian specifics such as GST and PIN codes
- Choosing column types and naming conventions a team can live with
- Schema migrations: adding, renaming and removing columns without downtime
Who it's for
- New backend developers who have only used an ORM's default models
- Founders and product people specifying a new application
- Analysts who want to understand why the database they query looks the way it does
Prerequisites
- Basic SQL helps but isn't required; we introduce the statements we use
- No programming language needed
- A free diagramming tool and PostgreSQL or MySQL installed (we help with setup)
Outcomes
By the end of this course you will be able to:
- Turn a written description of a business process into an ER diagram.
- Convert that diagram into normalised tables with keys and constraints that enforce the rules.
- Recognise design problems in an existing schema and propose fixes.
- Plan migrations that change a live schema without losing data.
Projects you'll build
- Clinic appointment system – model patients, doctors, schedules and bookings with rules against double-booking, practising relationships and constraints.
- Multi-vendor store – products, variants, vendors, orders, line items and GST details, practising many-to-many tables and modelling money.
- Schema rescue – review a deliberately flawed spreadsheet-style database and migrate it step by step to a clean design, practising normalisation and migrations.
Tools you'll use
dbdiagram.io or draw.io for ER diagrams, PostgreSQL 18 (with MySQL notes), and a migration tool such as Prisma Migrate, Laravel migrations or Flyway.
Course outline
| Module | Topic |
|---|---|
| 1 | Why design matters: real-world data bugs |
| 2 | Finding entities and rules in a domain |
| 3 | ER diagrams and notation |
| 4 | Relationships and junction tables |
| 5 | Keys and identifiers |
| 6 | Constraints as business rules |
| 7 | Normalisation and denormalisation |
| 8 | Common modelling patterns |
| 9 | Money, time, history and auditing |
| 10 | Types, naming and documentation |
| 11 | Schema migrations in practice |
| 12 | Project: design and build a complete schema |
FAQ
How does this differ from the MongoDB and NoSQL course?
This course is about relational design, which suits most business applications. MongoDB and NoSQL Data Modelling covers document databases, where you model around access patterns instead. We explain when each makes sense.
Is this an SQL course?
Not mainly. We write the SQL needed to create tables, but for querying in depth see SQL and PostgreSQL Essentials.
Does it matter whether I use PostgreSQL or MySQL?
The design principles are the same. We use PostgreSQL in examples and note where MySQL behaves differently.
How do I join?
Get in touch and we'll share the current format, schedule and enrolment details.