AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL NULLIF Function |
SQL > SQL NULL >
NULLIF Function
The NULLIF function takes two arguments. If the two arguments are equal, then NULL is returned. Otherwise, the first argument is returned. The syntax for NULLIF is as follows: NULLIF ("expression 1", "expressions 2")
It is the same as the following CASE statement: For example, let's say we have a table that tracks actual sales and sales goal as below:
Table Sales_Data We want to show NULL if actual sales is equal to sales goal, and show actual sales if the two are different. To do this, we issue the following SQL statement:
Result:
|
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.