SQL NOT NULL Constraint in Oracle: What Happens When You Insert a NULL Value?
When designing a database table, not every column should accept missing information.
For example, think about an employee database. Every employee must have an employee ID and a name. If the employee name is missing, the record may not be useful for the application or business.
This is where the NOT NULL constraint becomes important.
In this tutorial, we will understand how the NOT NULL constraint works in Oracle SQL, how to create a table using it, and what happens when we try to insert a NULL value into a mandatory column.
Understanding the NOT NULL Constraint
The NOT NULL constraint prevents a column from storing NULL values.
It is useful when a particular column must always contain a value.
Some common examples include:
Employee name
Customer name
Order date
Product name
Department name
For example, an employee table should not allow an employee record without a name if the name is mandatory for the…