前言
HackerRank中Basic Select专题Weather Observation Station 6
意思是查询首字母是元音(a,e,i,o,u)的city 数据;本文从 REGEXP、like、substring来编写查询语句
一、REGEXP\like\substring
1、使用正则表达式REGEXP
select CITY from station where CITY REGEXP '^[aeiouAEIOU]'
2、使用like
select CITY from station where CITY like 'a%' or city like 'e%' or city like 'o%' or city like 'i%' or city like 'u%'
3、使用substring
select CITY from station where substring(city,1,1) in ('a','e','i','o','u')