Search query using LIKE issues

Hi
today i was trying to get objects from the table and i needed to get any column value that end with “_”
so when i try this in the console like '%_' all the table objects show up.
the issue is not there if i dont use _

Hi Mohammad,

The underscore character _ is a special symbol in pattern matching. While % can substitute any number of characters in the pattern, the underscore can substitute only one.

To instruct the database to interpret the underscore as a literal symbol (not a pattern substitution) use the escape character as shown below:

national_id like '%\_'

Hope this helps.

Regards,
Mark

1 Like