Programming SQL NULL Values | A Little Discussion on NULL...

SQL NULL Values | A Little Discussion on NULL in SQL

-

In query SQL null values indicate the column with no values, or an empty column value. So a NULL value is an empty field in specific column. -where no value has been assigned.

When creating a table, or database, a field in a row left blank for not having appropriate data to fill in, so the table is saved with null values in that field. It is possible to insert data or update the table without adding data to that specific field(s).

Therefore it is worthwhile to remember that a NULL value in database is the field(s) that left blank during database creation.

SQL does not allow comparison operators ( =, <, > ) to test whether a field is null or not, rather it provide “IS NULL” or “IS NOT NULL” operator or constraint to check whether a field(s) in specific column is empty or not.

Query Syntax for SQL NULL Values

SELECT col-name-1, col-name-2, .. FROM table-name WHERE col-name IS NULL/IS NOT NULL AND/OR another-condition;

Now consider our movie table as shown below:

Table Name: Movies

IdTitleDirectorYear
1Carsjohn Lasseter2006
2UPPete Docter2009
3Ratatouille2007
4Toy StoryJohn Lasseter

So,  the query below will return following data.

SELECT * FROM Movies Where director IS NULL;

will return:

IdTitleDirectorYear
3Ratatouille2007

Read more on Wiki here »

Read more about SQL here »

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

Property Decorator | Getters Setters and Deleters in Python

In this article, we will talk about the Property Decorator in Python. It enables the class functionality...

Dictionaries | HashMap in Python | Working with Key-Values

Dictionaries in Python is similar to Hashmap comparing to other languages. It stores data as a key-value...

Hash Table | Indexing | Hashing Algorithm | Python Implementation

This article will talk about a high-level view of the Hash Table. As a programmer, this technique...

Eigenvector Eigenvalue | Linear Algebra Fundamentals

Eigenvector ($bar{v}$) in linear algebra is a non-zero vector (matrix) that doesn't change its direction during linear...

Pivot Table | Microsoft Excel | Create Data Insight Easily

Pivot table in microsoft Excel is an useful function that gives us a way to create insight...

Macro Function in Microsoft Excel | Automate Repetitive Task

This article we will talk about the Macro. It is a function in microsoft excel which basically...

Must read

Dictionaries | HashMap in Python | Working with Key-Values

Dictionaries in Python is similar to Hashmap...

You might also likeRELATED
Recommended to you