[solvesql] 제목이 모음으로 끝나지 않는 영화

yenpkr·2025년 3월 24일
0

sql

목록 보기
66/91

문제

제출

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')

📌 복습

✅ REGEXP

SQL에서 정규표현식을 활용하여 기본 연산자보다 복잡한 문자열 조건을 걸어 데이터를 검색할 수 있다.

matching

Numbers Limit

String Group

NOT

☑️ 문제 조건 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$')

참조 블로그

0개의 댓글