SELECT count(distinct name) from animal_ins where name is not null;
count 안에 distinct 코드를 사용하여 중복값은 체크하지 않는 걸로 설정!
not null 은 =가 아님 is임
문제:https://school.programmers.co.kr/learn/courses/30/lessons/59408
728x90
'Database > MySQL' 카테고리의 다른 글
[Mysql] group by에서 조건 줄때 사용 하는 Having, count(필드명) 자동 null 값은 카운트 하지 않음 (0) | 2022.07.10 |
---|---|
[Mysql] 같은 조건으로 gruop by 할 때 우선순위사용 가능한 union (0) | 2022.07.10 |
[Mysql] 테이블 3개 join , order by, group by, sum null값 지우기, case when (0) | 2022.07.09 |
[Mysql] 데이터 join, sum 예제 (0) | 2022.07.07 |
[Mysql] 데이터 합계, 내림차순, 오름차순 정렬 등 (0) | 2022.07.05 |
댓글