Need Assistance?

support@tutorialshub.in

Aggregate Functions & Grouping

Handling NULLs (COALESCE & NULLIF)

ADVERTISEMENT
PostgreSQL Free Lesson
5 min read
ADVERTISEMENT

COALESCE(val, fallback) returns the first non-null value. NULLIF(a, b) returns NULL if a = b—a classic trick to prevent division-by-zero errors (total / NULLIF(count, 0)).

ADVERTISEMENT
Hi, I'm Tuby! Here to help you