The NOT LIKE operator returns all records except the ones that match the pattern. The Basic syntax of a Not Like operator is:
Select <column_names>
From <table-name>
Where <column> NOT LIKE <pattern>
There are two ways in which we can use the Not like operator, one if the %
and the other is with an underscore character. The Underscore (_
) character checks for exactly one character, while the percent searches for zero or more.
This query will give back all the records that do not start with A.
select * from film where title NOT LIKE 'A%';
This query will check all such records that have exactly one character between T and A followed by any number of characters after A. So all the records with the word “Trailers” will be filtered.
select * from film where special_features NOT LIKE 'T_a%';