Auto Ads code

Saturday, June 15, 2019

How to compare NULL, NOT NULL and Blank in SQL

Compare NULL in SQL


  • IS keyword is use to compare NULL in SQL
  • Here in this example we will get all the record which has value NULL in Zip column
  • SELECT * FROM dbo.UserMaster WHERE Zip IS NULL

Compare NOT NULL in SQL



  • IS and NOT keyword is use to compare NOT NULL in sql
  • Here in this example we will get all the record which does not value NULL in Zip column
  • SELECT * FROM dbo.UserMaster WHERE Zip IS NOT NULL

Compare Blank value in SQL

  • = operator is use to compare blank value
  • Here in this example we will get all the record which has value Blank in Zip column
  • SELECT * FROM dbo.UserMaster WHERE Mobile = ''

No comments:

Post a Comment