NOT NULL constraint specifies a column may not contain NULL values.
Details
-
INSERTorUPDATEstatements containingNULLvalues are rejected. This includesINSERTstatements that do not include values for any columns that do not have aDEFAULTvalue constraint. For example, if the tablefoohas columnsaandb(andbdoes not have aDEFAULT VALUE), when you run the following command:CockroachDB tries to write aNULLvalue into columnb. If that column has theNOT NULLconstraint, theINSERTstatement is rejected. -
To add the
NOT NULLconstraint to an existing table column, use theALTER COLUMNstatement. -
For more information about
NULL, see NULL handling.
Syntax
You can only apply theNOT NULL constraint to individual columns.

