I see a SQL code like this
select * from table where id not like '%***%'
What is this code trying to exclude?
CodePudding user response:
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 ***
".
CodePudding user response:
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