iam new to sql and i would like to know how can I find the letter or symbol at the end of value in column called Name
?
E.g if i would find something i will
You're currently matching on: ..where 'Name' like '%es%'
.
Which equates to anything, then 'es' then anything else
.
Removing the last %
changes the where to
anything then 'es'
.
in short.. you need ..where 'Name' like '%es'
The query ..where 'Name' like '%es' will find columns where name ends with "ES". But if we need to find column where name ends with either "E" or "S", the query would be
.. where 'Name' LIKE '%[ES]'
You have to remove the last %
, so it will only select words ending with es
.
select * from table where Name like '%es'
You can also use REGEX
select distinct city from station where city REGEXP '[aeiou]$';
Resources: To Know more about REGEXP