SELECT DISTINCT CITY FROM STATION WHERE City LIKE 'a%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'e%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'i%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'o%'
Union
SELECT DISTINCT CITY FROM STATION WHERE CITY LIKE 'u%';
4条答案
按热度按时间isr3a4wc1#
你会用
regexp
:63lcw9qa2#
你可以用
OR
为了这个。qkf9rpyu3#
sql where子句可以有多个条件:
此外,由于您只关心以开头,因此可以切换到substr匹配:
尽管注意如果
city
上面有索引这可能性能较差(需要全表扫描)2g32fytz4#
在下列情况下,我们可以使用多个或: