SQL NOT NULL: How to Use While Creating Table

Here is an example SQL query on how to use NOT NULL constraint correctly. The term NOT NULL means, you should enter some value.

SQL NOT NULL is a column constraint. It should have always data. If you do not supply data, during insert or update, you will get check constraint errors.

SQL Query with NOT NULL Best Example

Create Table Artist
(artist_id int not null,
dob date not null,
salary int);

So the artist table does not allow null values for artist_id and dob. You must enter values.

SQL NOT NULL: How to Use While Creating Table

SQL NOT NULL Audio. Here you can listen complete post using your ear phone and your mobile phone.

The salary column is different, where it allows null values when you do not enter any amount.

Table Data of Artist



  • NOT NULL is a column constraint
  • Without values in the columns where NOT NULL defines, the SQL gives errors.
  • By default, all the columns accept NULL values

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.

Comments are closed.