Potato
์•ˆ๋…•ํ•˜์„ธ์š”, ๊ฐ์žก๋‹ˆ๋‹ค?๐Ÿฅ” ^___^ ๐Ÿ˜บ github ๋ฐ”๋กœ๊ฐ€๊ธฐ ๐Ÿ‘‰๐Ÿป

Algorithm/SQL Query test

[MySQL] HackerRank - Weather Observation Station 4

๊ฐ์ž ๐Ÿฅ” 2021. 7. 20. 03:21
๋ฐ˜์‘ํ˜•

๋ฌธ์ œ

https://www.hackerrank.com/challenges/weather-observation-station-4/problem

 

Weather Observation Station 4 | HackerRank

Find the number of duplicate CITY names in STATION.

www.hackerrank.com

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 ๋ณ„ ํ•œ๊ฐœ ๋ฑƒ์ง€๋ฅผ ๋ฐ›์•˜๋‹ค. ์ด๊ฑฐ ์€๊ทผ ์ˆ˜์ง‘์š•๊ตฌ๊ฐ€ ์˜ฌ๋ผ์˜ค๋Š” ๊ตฐ...!

์งœ์ž”

 

๋ฐ˜์‘ํ˜•