SQL: Creating Tables & Constraints

Wishlist Share

About Course

Design and create database tables that protect your data. Learn CREATE TABLE, choosing data types, primary keys, NOT NULL, UNIQUE, DEFAULT, CHECK and foreign key constraints, how to change tables with ALTER TABLE, and how database products differ. Examples were tested in SQLite and follow standard SQL.

Examples were tested in SQLite 3 with foreign keys enabled. Syntax and behaviour vary between database products; check your product’s documentation and test changes on a copy before using live data.

What Will You Learn?

  • Write CREATE TABLE statements with suitable data types Use primary keys, NOT NULL, UNIQUE, DEFAULT and CHECK constraints Link tables safely with foreign keys and understand ON DELETE options Change and remove tables with ALTER TABLE and DROP TABLE, carefully

Course Content

Course Lessons

  • Tables, columns and data types
  • Keys and basic constraints
  • Foreign keys and relationships
  • Changing and removing tables safely

Sources & Further Reading
The official guidance this course is based on.

Final Assessment

Student Ratings & Reviews

No Review Yet
No Review Yet

Want to receive push notifications for all major on-site activities?

✕