NOT NULL Constraint
SQLite possesses some useful constraints. NOT NULL Constraint is one of its constraints. This constraint ensures that a column or columns do not accept any NULL/Undefined values. In simple words, it makes the applied column accept only Not Null values. This helps in data integrity and prevents the insertion of incomplete information in the table.
Let’s take an Example Scenario:
Let us assume that we have created a table named ‘student’ and for its columns, we have name, roll, subject, and marks. Now we want the ‘name’ column to accept only values that are Not Null. In this kind of scenario, we can use NOT NULL Constraint.
Syntax:
CREATE TABLE table_name ( column_name datatype NOT NULL);
SQLite NOT NULL Constraint
SQLite is a very lightweight and embedded Relational Database Management System (RDBMS). It requires very minimal configuration and it is self-contained. It is serverless, therefore it is a perfect fit for mobile applications, simple desktop applications, and embedded systems. While it may not be a good fit for large-scale enterprise applications, it can offer simplicity, and portability and can be easy to use. In this article, we are going to cover its NOT NULL Constraint and its different aspects.