What is Not Null constraints?
->In Sql Server by default column holds NULL values but when we add NOT NULL constraints It cannot hold NULL values.
->Not Null constraints enforce a column to not accept NULL values.
Syntax
CREATE TABLE Table_name(
column1 Datatype1 NOT NULL,
column2 Datatype2 NOT NULL,
column3 Datatype3 NOT NULL,
column4 Datatype4
);
Example
CREATE TABLE Table_name(
EmpID Int NOT NULL,
Emp_Name Varchar(200) NOT NULL,
Address Varchar(200) NOT NULL,
Age int
);
->In Sql Server by default column holds NULL values but when we add NOT NULL constraints It cannot hold NULL values.
->Not Null constraints enforce a column to not accept NULL values.
Syntax
CREATE TABLE Table_name(
column1 Datatype1 NOT NULL,
column2 Datatype2 NOT NULL,
column3 Datatype3 NOT NULL,
column4 Datatype4
);
Example
CREATE TABLE Table_name(
EmpID Int NOT NULL,
Emp_Name Varchar(200) NOT NULL,
Address Varchar(200) NOT NULL,
Age int
);