본문 바로가기

프로그래밍/DB

중복없이 출력하는 명령어(distinct)

select distinct 열이 from 테이블명;


중복없이 카운트를 나타내는 명령어

select count(distinct 열이름) from 테이블명;


중복없이 카운트를 나타내면서 이름을 바꾸는 명령어

select count(distinct 열이름) as 바꾸려고하는 열이름 from 테이블명;