NOT NULL Constraint
NOT NULL ConstraintBy default, a column can hold NULL values. If you do not want a column to have a NULL value, then you need to define such constraint on this column specifying that NULL is now not allowed for that column.
A NULL is not the same as no data, rather, it represents unknown data.
ExampleThe following SQL creates a new table called CUSTOMERS, two of which, ID and NAME, specify not to accept NULLs:
If CUSTOMERS table has already been created, then to add a NOT NULL constraint to SALARY column in Oracle and MySQL:
CREATE TABLE CUSTOMERS( ID INT NOT NULL, NAME VARCHAR (20) NOT NULL, ADDRESS CHAR (25) , PRIMARY KEY (ID) );
Read more: NOT NULL Constraint
ALTER TABLE CUSTOMERS MODIFY SALARY DECIMAL (18, 2) NOT NULL;