Skip to Main Content

Write Great SQL Office Hours

Free tips and training every month! Subscribe for reminders and more from Office Hours. FAQ

Header container

February 21, 2023

14:00 UTC   Start Times Around the World

Subscribe to be notified of changes to sessions and give us feedback!

Having trouble watching the video on this page? Open the video in your browser.


Beginner's guide to database constraints
Constraints are a core feature of relational databases. Defining these improves data quality by preventing duplicate rows, orphaned rows, and columns with impossible values.

Watch the recording to learn how the major constraints - primary keys, unique constraints, foreign keys, not null, and check - work in Oracle Database.

Highlights include:

02:30 - Prevent duplicate rows
06:20 - Demo of primary keys and unique constraints
25:10 - Parent-child relationships
28:45 - Demo of foreign keys
41:10 - Making columns mandatory
42:50 - Demo of not null and check constraints
49:20 - Adding constraints on invalid data
53:15 - Demo of adding NOVALIDATE constraints
1:00:00 - Summary

Get the scripts for the demos
Learn SQL for free .html

Your Experts

    Chris Saxon

    Chris Saxon   

    Chris Saxon is an Oracle Developer Advocate and quizmaster on Dev Gym. His job is to help you get the best out of the Oracle Database and have fun with SQL! He's also part of the answer team on Ask TOM and creates YouTube videos at The Magic of SQL channel.