๋ฐ์ํ
๋ฌธ์
https://www.hackerrank.com/challenges/weather-observation-station-4/problem
Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.
where LAT_N is the northern latitude and LONG_W is the western longitude.
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 , because total number of records - number of unique city names = 3 - 2 = 1
์ ๋ต
SELECT COUNT(CITY) - COUNT(DISTINCT CITY)
FROM STATION
์ค,, ๊ทธ๋ฅ ๊ธฐ์ด๋ฌธ์ ๋ฅผ ํ์ด๋๊ธฐ๋ค๋ณด๋ ์ด๋์ธ SQL ๋ณ ํ๊ฐ ๋ฑ์ง๋ฅผ ๋ฐ์๋ค. ์ด๊ฑฐ ์๊ทผ ์์ง์๊ตฌ๊ฐ ์ฌ๋ผ์ค๋ ๊ตฐ...!
๋ฐ์ํ
'Algorithm > SQL Query test' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[MySQL] HackerRank - Weather Observation Station 6 (0) | 2021.07.22 |
---|---|
[MySQL] HackerRank - Weather Observation Station 5 (0) | 2021.07.22 |
[MySQL] HackerRank - Weather Observation Station 3 (0) | 2021.07.20 |
[MySQL] HackerRank - Weather Observation Station 1 (0) | 2021.07.20 |
[MySQL] HackerRank - Japanese Cities' Names (0) | 2021.07.20 |