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 čítaniaSQL · NULLIF · NULL · tutorial

NULLIF is the function "if two values are equal, return NULL; otherwise return the first". It's the perfect inverse of COALESCE and shines in two cases: safe division and cleaning placeholder values.

This article is currently in Russian. The full English translation is on the way.

Cvičte na reálnych úlohách

Riešte úlohy v SQL trénerovi s okamžitým hodnotením a nápovedami.

Otvoriť tréner