SQL constraints practice: CHECK, DEFAULT, UNIQUE and ON DELETE
SQL · Lesson 7
Ctrl/⌘ + Enter to run
✓
SQL Lesson 7 done.
Your tables now refuse bad data on their own: negative prices, zero quantities, made-up statuses, jobs that close before they open, the same mechanic booked twice. Missing values get a sensible DEFAULT, and deleting a row does the right thing to the rows that point to it: refuse, CASCADE or SET NULL. And before adding a rule to old data, you know how to find the rows that would break it.