Mysql NOT LIKE
From w3cyberlearnings
Contents |
MySQL NOT LIKE Function
This function is the opposite of LIKE function.
Syntax NOT LIKE
- expre 1 word or string
- expre 2 word or string to find within expre 1.
expre1 NOT LIKE expre2;
Note
_ for single character __ for two characters '_girl' matches 'Agirl', 'Bgirl', 'Zgirl' '__girl' matches 'ABgril', 'CZgirl', 'DDgirl' % for any character '%girl' matches 'lovely girl' or 'agirl' but not matches 'lovely girl k' '%girl%' matches 'lovely girl k'
Example 1
This return true, because good girl' is not the same as the word boy.
mysql> SELECT 'good girl' NOT LIKE 'boy'; +----------------------------+ | 'good girl' NOT LIKE 'boy' | +----------------------------+ | 1 | +----------------------------+ 1 row in set (0.00 sec)
Example 2
When use LIKE it return 0.
mysql> SELECT 'good girl' LIKE 'boy'; +------------------------+ | 'good girl' LIKE 'boy' | +------------------------+ | 0 | +------------------------+ 1 row in set (0.00 sec)