I see a SQL code like this
select * from table where id not like '%***%'
What is this code trying to exclude?
Asked
Active
Viewed 53 times
-2

hle
- 19
- 1
-
2in SQL `%` is a wildcard (zero or more characters). You are selecting any id without `***` in it – Joost Döbken May 04 '22 at 14:30
-
Does this answer your question? [SQL SELECT WHERE field contains words](https://stackoverflow.com/questions/14290857/sql-select-where-field-contains-words) – Osakr May 04 '22 at 14:35
2 Answers
0
The %
is a wildcard. The ***
doesn't mean anything special. So %***%
means "any string that has ***
somewhere in it."
If it was %***
it would be "any string that ended with ***
" and if it was ***%
it would be "any string that starts with ***
".

Andy Lester
- 91,102
- 13
- 100
- 152
0
Basically :
LIKE 'e%' -- results that start with “e”
LIKE '%e' -- results that ends with “e”
But here, with your example :
select * from table where id not like '%exemple%'
Here, you are going to search every id in your table except "exemple" keyword

elieeee
- 17
- 7