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 lukuaikaSQL · 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.

Harjoittele oikeilla tehtävillä

Ratkaise tehtäviä SQL-harjoittelussa välittömällä arvioinnilla ja vihjeillä.

Avaa harjoittelu