select * from example_table
where bool_col = false;
select * from example_table
where bool_col is false;
select * from example_table
where bool_col = 'true'; -- 문자열로 묶어도 댐
select null = false; -- null값 출력
select null is false; --false 출력
select * from example_table where num_col between 2 and 3;
select * from example_table where num_col not between 2 and 3;
select id, name,
case
when score <= 100 and score >= 90 then 'A'
when score <= 89 and score >= 80 then 'B'
when score <= 79 and score >= 70 then 'C'
when score <= 69 and score >= 60 then 'D'
when score <= 59 then 'F'
end score_grade, grade from student_score;
case~end 사이에 있는 조건대로, socre_grade 컬럼으로 출력됨
select id, name,
case
when grade = 'A' then '90점 이상입니다.'
when grade = 'B' then '80점 이상입니다.'
when grade = 'C' then '70점 이상입니다.'
when grade = 'D' then '60점 이상입니다.'
else '60점 미만입니다.'
end score_grade, grade from student_score;
위와 같이 등호인 경우, 아래처럼 적을 수 있음
select
id,
name,
case
grade when 'A' then '90점 이상입니다.'
when 'B' then '80점 이상입니다.'
when 'C' then '70점 이상입니다.'
when 'D' then '60점 이상입니다.'
else '60점 미만입니다.'
end score_grade,
grade
from
student_score;