Column constraints (NOT NULL, UNIQUE, CHECK)
📖 Scenario: You are creating a simple database table to store information about employees in a company. You want to make sure the data is clean and follows some rules.
🎯 Goal: Create a table called employees with columns that have constraints: id cannot be null, email must be unique, and age must be at least 18.
📋 What You'll Learn
Create a table named
employeesAdd a column
id that cannot be NULLAdd a column
email that must be UNIQUEAdd a column
age with a CHECK constraint to ensure age is 18 or older💡 Why This Matters
🌍 Real World
Companies use column constraints to keep their data accurate and reliable, like making sure emails are unique or ages are valid.
💼 Career
Database administrators and developers use constraints to enforce rules and prevent bad data from entering the database.
Progress0 / 4 steps