SQL - how to select words with specific meanings at the end of a word

iam new for sql, and I would like to know how to find the letter or character at the end of a value in a column called Name ? For example, if I found something, I would write select * from 'table' where 'Name' like '%es%' , but it will find me all the rows containing es
Say - lesl, pespe, mess ... but how to write select that will only select values ​​with 'es' At the end of the word? ... using regex , I will use es\Z ..... thanks in advance!

+7
source share
3 answers

You need to remove the last % , so it will select words ending in es .

 select * from table where Name like '%es' 
+10
source

You currently match: ..where 'Name' like '%es%' .

Which matches anything, then 'es' then anything else .

Removing the last % changes anything then 'es' .

in short .. you need ..where 'Name' like '%es'

+7
source

Request. where "Name", for example "% es", will find the columns where the name ends with "ES". But if we need to find a column where the name ends with either "E" or "S", the query will

.. where 'Name' LIKE '% [ES]'

+2
source

All Articles