MySQL WHERE절

MySQL WHERE절

MySQL WHERE절에 대해 설명하는 페이지입니다.

Environment

  • MySQL v8.0.34

목차

MySQL WHERE절

설명

WHERE절은 데이터를 필터링할 때 사용합니다. 특정 조건을 제시하여 해당 조건에 맞는 데이터만을 필터링할 수 있습니다. WHERE절을 사용하여 특정 데이터만을 조회하거나, 수정 및 삭제 등을 할 수 있습니다.

문법

select column1, column2, ... from table_name where condition;

WHERE절에서 사용 가능한 연산자

WHERE절에서 사용 가능한 연산자 목록은 다음과 같습니다.

OperatorDescriptionExample
=Equalwhere id = 10
>Greater thanwhere id > 10
<Less thanwhere id < 10
>=Greater than or equalwhere id >= 10
<=Less than or equalwhere id <= 10
!= or <>Not equalwhere id != 10
BETWEENBetween a certain rangewhere id between 10 and 20
LIKEsearch for a patternwhere city like “s%”
INTo specify multiple possible values for a columnwhere city in (“seoul”, “busan”)

Comments