DEV Community

Shaique Hossain
Shaique Hossain

Posted on

NOT NULL in SQL

NOT NULL in SQL is a constraint applied to a column in a table, ensuring that the column cannot have a NULL value. When a column is defined with the NOT NULL constraint, every row must have a valid, non-null value in that column. This ensures data integrity by preventing missing or unknown values where they are not allowed.

For example, if a name column is defined as VARCHAR(50) NOT NULL, any attempt to insert a row without a name or with a NULL value will result in an error.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay