MOD 함수

danbi lee·2023년 7월 30일

MOD(x, y)

x에서 y를 나눈 나머지값 반환

// 짝수
select distinct(CITY) from station where MOD(ID, 2) = 0;
// 홀수
select distinct(CITY) from station where MOD(ID, 2) = 1;

함수를 사용하지 않는 방법

select distinct(CITY) from station where ID % 2 = 0;
profile
계속해서 보완중

1개의 댓글

comment-user-thumbnail
2023년 7월 30일

개발자로서 성장하는 데 큰 도움이 된 글이었습니다. 감사합니다.

답글 달기