SQL 중급 - Group By & Having

Dazz_heyDay ·2023년 5월 6일
0

SQL

목록 보기
1/20
post-thumbnail

COUNT

SELECT COUNT(*) 
FROM sample; -> 5

SELECT COUNT(Name) 
FROM sample; -> 4
![](https://velog.velcdn.com/images/plussell/post/9b0cccaf-5ac4-44ea-af89-8ff76f9900cd/image.png)

SELECT COUNT(DISTINCT Name) 
FROM sample; -> 3

AVG

# NULL은 데이터가 없는 것으로 간주
SELECT AVG(Visits) 
FROM sample;


# NULL은 데이터가 0인 것으로 간주 
SELECT SUM(Visits)/COUNT(*) 
FROM sample;

종합 사용


Group By

+ Order By

Having

+ AS

profile
Why.Not.Now

0개의 댓글