Module 10 of 14

Database Design

Lessons

About This Module

Until now you've worked with tables someone else built. This module is about building them well. You'll create and change tables with CREATE TABLE and ALTER TABLE and protect your data with constraints — PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, and DEFAULT — so the database itself rejects bad data.

You'll also learn the thinking behind a good schema: normalization (1NF, 2NF, and 3NF) to remove duplicated and inconsistent data, and entity-relationship diagrams to plan tables and their one-to-many and many-to-many relationships before you write a line of SQL.

Work through the lessons in order, then continue on to Indexes & Performance.

Lessons

6 videos
01

SQL Constraints — Lesson 5 — Create or Add Constraints (Primary Key, Foreign Key, Default etc.)

How to define constraints when creating a table, or add them to an existing one, to enforce rules on your data.

02

SQL Tutorials 18: SQL Foreign Key Constraint

A focused lesson on foreign keys: linking one table to another and keeping those relationships valid.

03

What is Database Normalization?

An introduction to why normalization exists and the problems it solves, such as duplicated and inconsistent data.

04

Database Normalization Explained: 1NF, 2NF, 3NF with Real Examples

Walks through each of the first three normal forms with worked examples, turning a messy table into a clean design.

05

Entity Relationship Diagram (ERD) Tutorial — Part 1

An introduction to ER diagrams: entities, attributes, and relationships, and how to read and draw them.

06

Entity Relationship Diagram (ERD) Tutorial — Part 2: Primary keys, foreign keys, and bridge tables

Continues with keys and bridge tables, showing how to model many-to-many relationships in a real schema.