Since the NULLin field namedoes not fall into any of the queries.
In the ternary logic used SQL, NULL = 'Smith'both NOT NULL = 'Smith'are evaluated before NULLand filtered out.
Use the NULL-server comparison operator <=>:
SELECT * FROM `workers` WHERE `name` <=> 'Smith`
and
SELECT * FROM `workers` WHERE NOT `name` <=> 'Smith`
source
share