How to check for NULL values in SQL Query? The Right way Example

One of the most common SQL Interview question on Programming interview is to select some rows from a table which also contains null values. Since many SQL developers are used of using = and != operator on WHERE clause, they often tend to forget the fact that column allows NULL or not. Using = or != is perfectly fine if your column has NOT NULL constraint and you know for sure that there are no NULL values in that column, but if does contains NULLs then your query will return the incorrect result at times. This is one of the most common mistakes but at the same time hard to find SQL bugs if it managed to get into the real environment. In this article, you will learn the right way to check NULL values in SQL query using IS NULL and IS NOT NULL predicates.
Read more �

Posting Komentar

0 Komentar