Sql Query to use a Not Null Constraint


Not Null Constraint is used, when we don't want to keep the null value in a specific column of a table. After creating a table with a not null constraint, it doesn’t allow to insert an empty value.

By default, the column can hold a null value.

SQL Query
create table user_detail ( id int, email varchar(50) not null ); INSERT INTO user_detail VALUES(1,null);
Output