Not-Null Constraint

Definition & Meaning

Last updated 25 month ago

What is a Not Null Constraint?

The not-Null Constraint is a restriction located on a column in a Relational Database Table. It enforces the circumstance that, in that column, every row of Data must include a price – it can't be left blank in the course of Insert or UPDATE operations. If this column is left blank, this may produce an errors message and the whole insert or replace operation will Fail.

What Does Not-Null Constraint Mean?

Consider a desk named CUSTOMER_MASTER that shops customer info for a bank’s Database. Every consumer should have at least a surname and should belong to a positive gender. The columns managing surname and gender can then be marked as “NOT NULL” while creating the Customer_Master desk.

A pattern SQL script for doing that is given beneath: CREATE TABLE customer_master ( custid Integer Primary Key, surname CHAR NOT NULL, firstname CHAR, date_of_birth DATE NOT NULL, gender CHAR NOT NULL)

The now not-null constraint is a useful Device for database designers for implementing enterprise common sense. Instead of the use of Programming Code to put into effect the “should continually have a value” idea, they really use a integrated database feature.

Sometimes the no longer-null constraint is implicit. When a column is marked as a number one key (see the “custid” column in our Instance above), it's miles used to uniquely Discover all rows in the desk so they obviously cannot be left clean.

Share Not-Null Constraint article on social networks

Your Score to Not-Null Constraint article

Score: 5 out of 5 (1 voters)

Be the first to comment on the Not-Null Constraint

6789- V29

tech-term.com© 2023 All rights reserved