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
In questa pagina del sito puoi guardare il video online Using SQL NULLIF with Missing Values | Essential SQL della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Essential SQL (EssentialSQL) 27 luglio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,167 volte e gli è piaciuto 62 spettatori. Buona visione!