SQL - SPLessons

SQL IsNull

Chapter 28

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQL IsNull

SQL IsNull

shape Description

SQL Databases are huge gathering of logical related information which can be created, accessed, managed, and updated. The data can may be in any form like text and numbers. All relational database management systems like MySQL, MS Access, Oracle, Sybase, Postgre and SQL Server use SQL as standard database language.

SQL IsNull function replaces the null value with customized or desired value. It will check whether the esteem of the column is Null, then it will put the customized or desired value otherwise it will keep the column value. And the column parameters specifies the name of the columns of the table and the datatypes parameters specifies the type of data that the column is holding that may varies from varchar, decimal, date and integers.

shape Conceptual

shape Syntax

The syntax for ISNULL function is as follows
ISNULL(expression,alternative value)

alternate_value => Must have same datatype as expression.

shape Examples

SELECT student_name, ISNULL(contact_number,'NA')FROM student_details;

If contact number is present for the student then it will show corresponding contact number else it will show NA in contact number field in result set.

SELECT ISNULL(NULL, ' Null value found');

Output will show as:

Null value found


shape Key Points

  • SQL ISNULL Function – Replace the null value with our customized or desired value.