MySQL + SQL · Lesson 49
IS NULL and IS NOT NULL
What is NULL?
NULL means "no value" — empty/unknown. It is NOT the same as 0 or an empty string. You cannot test it with
=; use IS NULL.Examples
-- find students with no phone number
SELECT * FROM students WHERE phone IS NULL;
-- find students who have a phone number
SELECT * FROM students WHERE phone IS NOT NULL;
Common Trap
WHERE phone = NULL does NOT work and returns nothing. Always use IS NULL / IS NOT NULL.Summary
- NULL = unknown/missing, not 0 or empty.
- Test with
IS NULL/IS NOT NULL, never= NULL.
💻 Live Code Editor
Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.