Answer: Yes.We can provide check constraints on multiple columns as shown below example:
Create Table Employee_Master
(
Employee_Id int not null,
First_Name varchar(100) not null,
Middle_Name varchar(100),
Last_Name varchar(100) not null,
Employee_Name varchar(100) not null,
PAN_Number varchar(10) not null,
LDAP varchar(10) not null,
Check ([Employee_Id] > 0
And [PAN_Number] Is Not Null
And [LDAP] Is Not Null)
)
Here,Check Constraints are applied on Employee_Id,Pan_Number and LDAP columns which says that employee id must be greated than zero(0) and
PAN number and LDAP column can not have Null values.
Asked In: Many Interviews |
Alert Moderator