hackerrank Weather Observation Station 4

홍진우·2024년 2월 18일

SQL

목록 보기
3/4

Q: Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.
For example, if there are three records in the table with CITY values 'New York', 'New York', 'Bengalaru', there are 2 different city names: 'New York' and 'Bengalaru'. The query returns 1 ( hint : total number of records - number of unique city names)

SELECT COUNT(*)-COUNT(DISTINCT CITY) 
FROM STATION

중복값을 제거할때 distinct를 적어둔다.

profile
데이터분석/ AI논문리뷰/알고리즘 공부

0개의 댓글