From the course: Relational Databases Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add check constraints

Add check constraints

From the course: Relational Databases Essential Training

Start my 1-month free trial

Add check constraints

- [Lecturer] There's one more type of constraint that I want to talk about, and that's a check constraint or what's sometimes referred to as an integrity constraint or a validation rule, depending on the RDBMS platform that you're working with. Like null constraints, default values, and unique constraints, check constraints are built right into the design of the table itself. Then, anytime data is entered into the table, the database management system will verify the new values meet the criteria that have been established. For numerical data, you can check that the values fall within a range of acceptable values. For instance, a products price must be above zero and therefore can't be negative. Or an employee's job rating must be between one and five. Many of these kinds of data constraints will be dictated by your business rules. For character data types, it's rare that you would specify an alphabetical range, but you can create a check constraint that limits the possible values to…

Contents