How to find the city name not starting and ending with a vowel

前端 未结 4 731
太阳男子
太阳男子 2021-01-28 04:56

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

4条回答
  •  忘掉有多难
    2021-01-28 05:58

    A little easier to read would be:

        SELECT DISTINCT  CITY 
        FROM STATION 
        WHERE  SUBSTR(CITY,1,1) NOT IN ('A','E','I','O','U')
        AND SUBSTR(CITY,-1,1) NOT IN ('A','E','I','O','U');
    

    Note the -1 in the second WHERE clause which tells Oracle to search from the end of the string.

提交回复
热议问题