ISNULL in SQL - sql - sql tutorial - learn sql




  • In SQL Server, the ISNULL( ) function is used to replace NULL value with another value.
  • ISNULL( ) function is available in both SQL Server and MySQL even though they are different.
  • For example, if we have the following table,

Table Wikitechy_Sales_Data

Store_Name Sales
Store A 300
Store B NULL
  • The following SQL,
SELECT SUM (ISNULL(Sales,100)) FROM Wikitechy_Sales_Data;
  • Returns the following result:
SUM (ISNULL(Sales,100))	
400	
  • This is because NULL has been replaced by 100 via the ISNULL function, so the total becomes 300 + 100 = 400.
Tags : sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorial

MySQL:

  • In MySQL, the ISNULL( ) function is used to test whether an expression is NULL.
  • If the expression is NULL, this function returns 1.
  • Otherwise, this function returns 0.
  • For example,
  • ISNULL(3*3) returns 0
  • ISNULL(3/0) returns 1

SQL isnull VS is not null

SQL  isnull is not null

This tutorial provides more the basic needs and informations on sql tutorial , pl sql tutorial , mysql tutorial , sql server , sqlcode , sql queries , sql , sql formatter , sql join , w3schools sql , oracle tutorial , mysql , pl sql , learn sql , sql tutorial for beginners , sql server tutorial , sql query tutorial , oracle sql tutorial , t sql tutorial , ms sql tutorial , database tutorial , sql tutorial point , oracle pl sql tutorial , oracle database tutorial , oracle tutorial for beginners , ms sql server tutorial , sql tutorial pdf

Related Searches to ISNULL in SQL