Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a difference between "not null" and "not null enable"?

Tags:

sql

oracle

When we define a table in Oracle we may define the columns as:

"NAME" VARCHAR2(80) NOT NULL ENABLE 

My question is I could not understand the meaning of "ENABLE" in this statement. What would be the difference if we just define as "NAME" VARCHAR2(80) NOT NULL ?

like image 350
death7eater Avatar asked Dec 15 '13 13:12

death7eater


People also ask

What is not null enable?

By default, a column can hold NULL values. The NOT NULL constraint enforces a column to NOT accept NULL values. This enforces a field to always contain a value, which means that you cannot insert a new record, or update a record without adding a value to this field.

Is is not NULL same as <> NULL?

The IS NULL condition is satisfied if the column contains a null value or if the expression cannot be evaluated because it contains one or more null values. If you use the IS NOT NULL operator, the condition is satisfied when the operand is column value that is not null, or an expression that does not evaluate to null.

When should NOT NULL be used?

A NOT NULL constraint in SQL is used to prevent inserting NULL values into the specified column, considering it as a not accepted value for that column. This means that you should provide a valid SQL NOT NULL value to that column in the INSERT or UPDATE statements, as the column will always contain data.

WHAT DOES NOT NULL mean?

The NOT NULL constraint enforces a column to not accept NULL values, which means that you cannot insert or update a record without adding a value to this field.


1 Answers

ENABLE is the default state, so leaving it out has the same effect. The opposite would be to specify DISABLE, in which case the constraint would not be active.

See the constraint documentation for more information.

like image 75
Mat Avatar answered Sep 22 '22 07:09

Mat