SELECT
title
FROM
film
WHERE
rating in ('R', 'NC-17')
AND title not like('%A')
and title not like('%E')
and title not like('%I')
and title not like('%O')
and title not like('%U')
SQL에서 정규표현식을 활용하여 기본 연산자보다 복잡한 문자열 조건을 걸어 데이터를 검색할 수 있다.
☑️ 문제 조건 REGEXP로 풀었을 때
WHERE title not REGEXP ('A$|E$|I$|O$|U$')
title 컬럼에서 A,E,I,O,U로 끝나지 않는 데이터를 가져온다.
SELECT title
FROM film
WHERE rating in ('R','NC-17')
AND
title not REGEXP ('A$|E$|I$|O$|U$')