The NULLIF is a nice short hand way to compare for missing values within columns contains both NULL and blank values.
--------------------
This video is part of my Beginner Learning series. If you're interested in learning SQL subscribe to @Essential SQL and then check out our Beginner Learner Playlist.
Of course, I also encourage you to visit https:\\www.essentialsql.com to learn even more!
----------------------
Here are the example I used in the video, use them to learn more about NULL IF and play around with it's features:
SELECT FirstNAme, MiddleName, LastName
FROM Person.Person
WHERE NULLIF(MiddleName,'') IS NULL
SELECT FirstNAme, MiddleName, LastName
FROM Person.Person
WHERE case when MiddleName = '' then NULL else MiddleName end IS NULL
SELECT FirstNAme, MiddleName, LastName
FROM Person.Person
WHERE IIF(MiddleName = '',NULL,MiddleName) IS NULL
En esta página del sitio puede ver el video en línea Using SQL NULLIF with Missing Values | Essential SQL de Duración hora minuto segunda en buena calidad , que subió el usuario Essential SQL (EssentialSQL) 27 julio 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 2,167 veces y le gustó 62 a los espectadores. Disfruta viendo!