SQLNULLIFNULLtutorial
What is NULLIF in SQL? Safe division and cleanup for beginners
NULLIF returns NULL if two values are equal. Plain words: safe division via NULLIF(x, 0), cleaning placeholder values like '' or 'unknown', and pairing with COALESCE for clean data handling. With tables and common pitfalls.
1 min readSQL · NULLIF · NULL · tutorial
NULLIFis the function "if two values are equal, return NULL; otherwise return the first". It's the perfect inverse ofCOALESCEand shines in two cases: safe division and cleaning placeholder values.This article is currently in Russian. The full English translation is on the way.