How to define a Check Constraint while creating Tables in MySql?

 Posted by vishalneeraj-24503 on 9/1/2014 | Category: Sql Server Interview questions | Views: 333 | Points: 40

Following script creates a Check Constraint on Employee_Master table :-
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 ([PAN_Number] Is Not Null)

Here, I have used a Check clause that is associated with the PAN_Number column,which indicates that Pan Number should not accept any null values.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response