본문 바로가기
Back End/AWS & MySQL

MySQL 데이터 중복제거 distinct

by healingmau 2022. 5. 16.

 

MySQL 데이터 중복제거 distinct

 

참고할 기본 데이터

 


distinct 컬럼명

중복없는 유니크한

데이터 가져오는 가져옵니다.

 

a. author_lname 의 이름을 중복없이 가져오세요.

 

1
2
3
4
5
6
select author_fname
from books;
 
-- 중복을 제거할대 사용
select distinct author_fname
from books;
cs

 

b. 작가의 full name을 중복없이 가져오세요.

 

1
2
select distinct( concat( author_fname, ' ', author_lname ) )
from books;
cs

댓글