SQL query to check if a name begins and ends with a vowel

后端 未结 25 1143
臣服心动
臣服心动 2020-11-30 23:16

I want to query the list of CITY names from the table STATION(id, city, longitude, latitude) which have vowels as both their first and last charact

25条回答
  •  臣服心动
    2020-12-01 00:06

    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%'
    ) AND (CITY LIKE '%a' 
        OR CITY LIKE '%e'
        OR CITY LIKE '%i'
        OR CITY LIKE '%o'
        OR CITY LIKE '%u'
    )
    

提交回复
热议问题