In OceanBase Database, a NOT NULL constraint is used to ensure that a specified column of a table is never assigned a null value.
The syntax is as follows:
column_name data_type NOT NULL;
If a NOT NULL constraint is defined on a column, you cannot insert a NULL into or update an existing value to a NULL in the column.
To be more exact, a NOT NULL constraint on a column is actually an attribute of the column because you cannot find information about NOT NULL constraints among the constraint-related tables in INFORMATION_SCHEMA, such as the CHECK_CONSTRAINTS, REFERENTIAL_CONSTRAINTS, TABLE_CONSTRAINTS, and TABLE_CONSTRAINTS_EXTENSIONS tables.
In an OceanBase database, you can delete but not add a NOT NULL constraint on a column. The syntax to delete a NOT NULL constraint on a column is as follows:
ALTER TABLE table_name MODIFY column_name data_type;