Tuesday 9 October 2018

SQL NOT LIKE will not applicable for NULL values

Example:
select * from emp WHERE Name NOT LIKE '%ABC%' --will return only where Name not like %ABC%, but will not return where Name is NULL

select * from emp WHERE (Name NOT LIKE '%ABC%' OR Name IS NULL) --will return only where Name not like %ABC% and will return where Name is NULL