Null is a special marker used in Structured Query Language (SQL) to indicate that a data value does not exist in the database. NULL means missing information and inapplicable information”. NULL values represent missing unknown data. By default, a table column can hold NULL values.
If a column in a table is optional, we can insert a new record or update an existing record without adding a value to this column. This means that the field will be saved with a NULL value.
NULL values are treated differently from other values. It is not same as ZERO or BLANK. NULL means there exist some value but still it’s unknown. Whereas The NOT NULL constraint allows a column not to accept NULL values. This specifies that NOT NULL Constraint enforce the field to accept a value. This means that you cannot insert a new record, or update a record without adding a value to this field.
List the Employee NAME, SAL who doesn’t work under any Manager
SQL> SELECT ENAME, SAL FROM EMP WHERE MGR IS NULL;
List the Employee NAME, SAL whose salary greater than 3000 and getting no Commission.
SQL> SELECT ENAME, SAL FROM EMP WHERE SAL>3000 AND COMM IS NULL;
List the Employee NAME, SAL who is getting commission
SQL> SELECT ENAME, SAL FROM EMP WHERE COMM IS NOT NULL;