TechnoLearnAcademy

TECHNOLEARN

CHECK CONSTRAINT

A CHECK constraint is used to enforce specific conditions on the values that are inserted or updated in a column within a table.

Example:

   Objective: In this example, we will enforce a condition on the email address column. The character length of the email                            address must be greater than 5.                                                                                                                                                        CREATE TABLE TBL_EMP(Ecode varchar(20) Primary key,
                                                                   Name varchar(20),
                                                                   Emailaddress varchar(20) CHECK(len(emailaddress)>5),
                                                                   Department varchar(20),
                                                                   Salary int
                                                                              );
Scroll to Top