From the course: Oracle Database 19c: Advanced SQL
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Unique indexes and constraints - Oracle Database Tutorial
From the course: Oracle Database 19c: Advanced SQL
Unique indexes and constraints
- [Instructor] Constraints in an Oracle Database are required to ensure data integrity and using a unique index, I'll focus on using in-line constraints with those indexes. Out of the many ways you can validate data within an Oracle Database, a unique constraint is well unique. Here's what a unique constraint looks like. Two data dictionary objects are created, a constraint along with a unique index to enforce the uniqueness of the constraint. If one of the column values in a multicolumn unique index has a null value in one or more rows, that's allowed in a unique index as long as the combination of all columns with non-null values is unique in the table. This is important when you have a primary key constraint. And I discussed that distinction in another lesson. I'm creating a unique constraint on the region name column of the REGIONS table. While the REGION ID column is a primary key and also unique, I do want the REGION NAME column to be unique too, since in the data model, it's a…