TechnoLearnAcademy

TECHNOLEARN

SQL NOT NULL CONSTRAINT

The NOT NULL constraint is used to specify that a column must contain a value and cannot contain NULL.

Example:

   Objective: In this example, we will assign NOT NULL constraint to the department column.
                      CREATE TABLE TBL_EMP(
                                                              Ecode varchar(20) Primary key,
                                                              Name varchar(20),
                                                              Emailaddress varchar(20),
                                                              Department varchar(20) NOT NULL,
                                                              Salary int
                                                                              );
Scroll to Top