We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Weather Observation Station 11
Weather Observation Station 11
Sort by
recency
|
3630 Discussions
|
Please Login in order to post a comment
select Distinct(City) from station where Right(City,1) not in ('a','e','i','o','u') OR Left(City,1) not in ('a','e','i','o','u')
For MySQL:
SELECT distinct CITY FROM STATION WHERE CITY REGEXP '^[^aeiou]' OR CITY REGEXP '[^aeiou]$';
This was my original answer:
It didn't give me any city name starting with a vowel or with a vowel at the end (unless the city name was compounded by two words, in that case, if the first word ended in a vowel or the second word started with a vowel it would be part of the output). However, it was not accepted, so I saw on the discussion section that someone put as a solution the following code:
This is fine, but it doesn't prevent SQL from giving you city names with a vowel at the end due to the OR condition. However, it is accepted as a valid answer. I think the problem is not correctly formulated or the solution is not correctly programmed.
MS SQL Server
select distinct city from Station where (city not like "a%" and city not like "e%" and city not like "i%" and city not like "o%" and city not like "u%") or (city not like "%a" and city not like "%e" and city not like "%i" and city not like "%o" and city not like "%u")
SELECT DISTINCT CITY FROM STATION WHERE CITY NOT LIKE '[A,E,I,O,U]%' OR CITY NOT LIKE '%[A,E,I,O,U]';