본문 바로가기

hackerrank weather5

[MYSQL] Weather Observation Station 2 ▶ SQL > Aggregation > Weather Observation Station 2 Problem Query the following two values from the STATION table: The sum of all values in LAT_N rounded to a scale of 2 decimal places. → LAT_N의 모든 값의 합을 소수점 2자리까지 반올림한 값 The sum of all values in LONG_W rounded to a scale of 2 decimal places. → LONG_W의 모든 값의 합을 소수점 2잘까지 반올림한 값 Input Format The STATION table is described as follows: where LAT_N is.. 2021. 8. 9.
[MySQL] Weather Observation Station 11 ▶ SQL > Basic Select > Weather Observation Station 11 Problem Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates. The STATION table is described as follows: → 모음으로 시작하지 않거나 모음으로 끝나지 않는 CITY names, 중복X My Answer SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[^aeiou]' OR CITY REGEXP '[^aeiou]$' * R.. 2021. 4. 7.
[MySQL] Weather Observation Station 4 ▶ SQL > Basic Select > 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. The STATION table is described as follows: > 표에 있는 총 CITY 항목 수와 표에 있는 고유 CITY 항목 수의 차이를 구하라. My Answer SELECT COUNT(CITY) - COUNT(DISTINCT(CITY)) FROM STATION NOTE *집계함수 COUNT : 행 개수 구하기 SELECT COUNT(열1), COUN.. 2021. 3. 31.
[MySQL] Weather Observation Station 3 ▶ SQL > Basic Select > Weather Observation Station 3 Problem Query a list of CITY names from STATION for cities that have an even ID number. Print the results in any order, but exclude duplicates from the answer. → 중복X The STATION table is described as follows: My Answer SELECT DISTINCT CITY FROM STATION WHERE ID % 2 = 0 NOTE DISTINCT : unique한 컬럼이나 튜플을 조회하는 경우 사용 정렬하지 않고 결과를 가져옴 GROUP BY에 비해 성능.. 2021. 3. 30.
[MySQL] Weather Observation Station 1 ▶ SQL > Basic Select > Weather Observation Station 1 Problem Query a list of CITY and STATE from the STATION table. The STATION table is described as follows: My Answer SELECT CITY, STATE FROM STATION 2021. 3. 30.
728x90