일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- torch
- LSTM
- t분포
- 서브쿼리
- 코딩테스트
- MySQL
- Statistics
- SQL 날짜 데이터
- 그룹바이
- sql
- SQL코테
- update
- NLP
- leetcode
- nlp논문
- inner join
- Window Function
- 표준편차
- 자연어처리
- 짝수
- GRU
- HackerRank
- sigmoid
- 카이제곱분포
- 논문리뷰
- airflow
- 자연어 논문 리뷰
- 자연어 논문
- CASE
- 설명의무
- Today
- Total
HAZEL
[SQL : HackerRank] Population Density Difference , Weather Observation Station 11, Weather Observation Station 13 본문
[SQL : HackerRank] Population Density Difference , Weather Observation Station 11, Weather Observation Station 13
Rmsid01 2021. 2. 27. 19:541] Population Density Difference
>> 문제
Query the difference between the maximum and minimum populations in CITY.
Input Format
The CITY table is described as follows:
>> 문제 푼 코드
select max(population) - min(population)
from city
www.hackerrank.com/challenges/population-density-difference/problem
Population Density Difference | HackerRank
Query the difference between the maximum and minimum city populations in CITY.
www.hackerrank.com
2] Weather Observation Station 11
>> 문제
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.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
>> 문제 해결 코드
select distinct city
from station
where ( city NOT LIKE 'A%' and city NOT LIKE 'E%' and
city NOT LIKE 'O%' and city NOT LIKE 'I%' and city NOT LIKE 'U%')
or ( city NOT LIKE '%a' and city NOT LIKE '%e' and
city NOT LIKE '%o' and city NOT LIKE '%i' and city NOT LIKE '%u' )
>> 더 간단하게 표현할 수 있는 코드
select disticnt city
from staition
where left(city, 1) Not in ('A', 'E', 'I', 'O' , 'U')
OR RIGHT(city, 1) Not in ('A', 'E', 'I', 'O' , 'U')
※ left / right 함수를 이용해서 풀 수 있다는 점을 기억하다.
www.hackerrank.com/challenges/weather-observation-station-11/problem
Weather Observation Station 11 | HackerRank
Query a list of CITY names not starting or ending with vowels.
www.hackerrank.com
3] Weather Observation Station 13
>> 문제
Query the sum of Northern Latitudes (LAT_N) from STATION having values greater than and less than . Truncate your answer to decimal places.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
>> 문제 푼 코드
select truncate(sum(lat_n), 4)
from station
where lat_n > 38.7880 and lat_n < 137.2345
: 집계함수가 있는 것은 굳이 groupby안해도된다! 없는 것은 해야한다! 잊지말자
www.hackerrank.com/challenges/weather-observation-station-13/problem
Weather Observation Station 13 | HackerRank
Query the sum of Northern Latitudes having values greater than 38.7880 and less than 137.2345, truncated to 4 decimal places.
www.hackerrank.com