I\'m trying to query the list of CITY names from STATION that do not start with vowels and do not end with vowels. The result cannot contain duplicates.
At first I tried
Your first query would be correct if you used AND
rather than OR
.
You might find it the logic simpler as:
where not (city like 'A%' or city like 'E%' or . . . ) and
. . .
By the rules of logic, this is equivalent to:
where city not like 'A%' and city not like 'E%' and . . . ) and
. . .
As for the regular expression, it has only the comparison at the beginning of the string:
where not regexp_like(lower(city), '^[aeiou].*[aeiou]$')