I have a mysql table that has 2796 entries. I’d like to select entries that doesn’t contain the word SUPPR somewhere in the notes field.
If I do the following
SELECT * FROM `catalogues` WHERE notes LIKE "%SUPPR%"
It returns 266 row. But if I write what I consider the complement
SELECT * FROM `catalogues` WHERE notes not LIKE "%SUPPR%"
it returns 762 rows when I was expecting 2530 (2796-266).
How should I write the second request to get what I need?
Nulls are implicitly excluded when you use
NOT LIKE.You handle separately:
Perhaps this was only for illustrative purposes that you used it…
DBAs and performance-buffs recommend against using
SELECT *.