I would like to query a list of cities that end in vowels and I would like each city in the list to be distinct. The code noted below works fine but I would like to achieve the same thing using the IN or ANY operators.I have attached a picture of the description of the table I’m working with. Thank you!
x
SELECT DISTINCT City FROM Station
WHERE City LIKE '%a'
OR City LIKE '%e'
OR City LIKE '%i'
OR City LIKE '%o'
OR City LIKE '%u';
Advertisement
Answer
Use regexp
select DISTINCT
City FROM Station
WHERE regexp_like(city,'[aeiou]$')