강의

멘토링

커뮤니티

Inflearn Community Q&A

jason8373's profile image
jason8373

asked

SQL problem solving for data analysis (Advent of SQL 2024)

Day 4. Counting Ttareungi Stations by Local Government (Beginner Week 2)

Day4. COUNT(*) 만해도 충분한 이유

Resolved

Written on

·

106

·

Edited

0

COUNT(station_id) 굳이 안쓰고,

COUNT(*) 만해도 충분한 이유가 뭔가요?

 

어차피 station_id 는 고윳값이니까.

(DISTINCT 안써도 되는 것) = (COUNT *) 만해도 충분한 것.

같은 이유일까요?

sqlmysqlpostgresqlsqlite

Answer 1

0

sunmiyoon님의 프로필 이미지
sunmiyoon
Instructor

안녕하세요. DISTINCT를 안써도 되는 것과는 약간 이유가 다릅니다. station_id에 NULL이 없기 때문에 COUNT(*)COUNT(station_id)의 값이 동일합니다.

Jason님의 프로필 이미지
Jason
Questioner

아~~~~~ 그렇군요! 감사합니다!

jason8373's profile image
jason8373

asked

Ask a question