728x90
Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates.
Input Format
The STATION table is described as follows:
/*
문자열 함수 활용
*/
SELECT
DISTINCT city
FROM station
WHERE
LEFT(city,1) not in ('a', 'e', 'i', 'o', 'u')
OR RIGHT(city,1) not in ('a', 'e', 'i', 'o', 'u')
/*
정규 표현식 활용
*/
SELECT
DISTINCT city
FROM station
WHERE
city REGEXP '^[^aeiou]' OR city REGEXP '[^aeiou]$'
'SQL' 카테고리의 다른 글
Mysql 정규식 (0) | 2021.10.21 |
---|---|
SQL 작성 팁 (0) | 2021.10.18 |
MYSQL 테이블 구조 수정 (0) | 2021.08.04 |
MYSQL 테이블 생성 (0) | 2021.08.04 |
MYSQL 데이터 타입 (0) | 2021.08.04 |