이 영역을 누르면 첫 페이지로 이동
쿄코코 블로그의 첫 페이지로 이동

쿄코코

페이지 맨 위로 올라가기

쿄코코

얼레벌레 생활🤯

Weather Observation Station 16,17,18,19 | Population Census

  • 2022.10.24 22:38
  • SQL/HackerRank
    반응형

     

    Weather Observation Station 16 📝 

    https://www.hackerrank.com/challenges/weather-observation-station-16/problem?isFullScreen=true 

    ➡️ station 테이블 

    • 38.7780보다 큰 lat_n 중 가장 작은 값 ( 단, 소숫점 5자리에서 반올림) => min,round 함수 사용
     
     

    Query the smallest Northern Latitude (LAT_N) from STATION that is greater than 38.7780. Round your answer to 4 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 round(min(lat_n),4) 
    FROM station 
    WHERE lat_n>38.7780;

     


     

    Weather Observation Station 17📝 

    https://www.hackerrank.com/challenges/weather-observation-station-17/problem?isFullScreen=true 

    ➡️ station 테이블 

    • 출력 : long_w 소수점 5자리에서 반올림
    • =>조건 1 : lat_n이 38.7780보다 큰 값중에서 가장 작은 값

     

     

    Query the Western Longitude (LONG_W)where the smallest Northern Latitude (LAT_N) in STATION is greater than 38.7780. Round your answer to 4 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 ROUND(long_w,4)
    FROM station
    WHERE lat_n = (SELECT min(lat_n) FROM station WHERE lat_n>38.7780);

     


     

    Weather Observation Station 18📝 

    https://www.hackerrank.com/challenges/weather-observation-station-18/problem?isFullScreen=true 

    ➡️ station 테이블 

    • 출력 : Manhattan Distance P1(a,b) P2(c,d) 사이의 거리 구하기
    • => 조건 1 : Manhattan Distance : |a-c| + |b-d| 
    • => 조건 2: la-c| = lat_n의 최댓값 - lat_n의 최솟값 
    • => 조건 3: |b-d| = long_w의 최댓값 - long_w의 최솟값 
     

    Consider  P1(a,b) and  P2(c,b) to be two points on a 2D plane.

    •  a happens to equal the minimum value in Northern Latitude (LAT_N in STATION).
    •  b happens to equal the minimum value in Western Longitude (LONG_W in STATION).
    •  c happens to equal the maximum value in Northern Latitude (LAT_N in STATION).
    •  d happens to equal the maximum value in Western Longitude (LONG_W in STATION).

    Query the Manhattan Distance between points P1 and P2 and round it to a scale of 4 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 ROUND(max(lat_n)-min(lat_n)+max(long_w)-min(long_w),4)
    FROM station;

     


     

    Weather Observation Station 19📝 

    https://www.hackerrank.com/challenges/weather-observation-station-19/problem?isFullScreen=true 

    ➡️ station 테이블 

    • 출력 : Euclidean Distance P1(a,c) P2(b,d) 사이의 거리 구하기
    • => 조건 1 : Euclidean Distance  : 루트( (a-b)^2 + (c-d)^2 )
    • => 조건 2: a-b = lat_n의 최댓값 - lat_n의 최솟값 
    • => 조건 3: c-d = long_w의 최댓값 - long_w의 최솟값 
     

    Consider  P1(a,c) and P2(b,d) to be two points on a 2D plane where (a,b)  are the respective minimum and maximum values of Northern Latitude (LAT_N) and (c,d)  are the respective minimum and maximum values of Western Longitude (LONG_W) in STATION. 

    Query the Euclidean Distance between points P1 and P2 and format your answer to display 4 decimal digits.

    Input Format

    The STATION table is described as follows:

    where LAT_N is the northern latitude and LONG_W is the western longitude

    SELECT ROUND(SQRT(POWER(max(lat_n)-min(lat_n),2)+POWER(max(long_w)-min(long_w),2)),4)
    FROM station;

     


     

    Population Census📝 

    https://www.hackerrank.com/challenges/asian-population/problem?isFullScreen=true 

    ➡️ city 테이블,country 테이블 

    • 출력 : SUM(city.population)
    •  조건 1 : country.continent='Asia'
    •  조건 2 : 테이블 JOIN city.countrycode = country.code
     

    Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is 'Asia'.

    Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

    Input Format

    The CITY and COUNTRY tables are described as follows:

    SELECT SUM(city.population)
    FROM city JOIN country ON city.countrycode = country.code
    WHERE country.continent='Asia';

     

    반응형

    'SQL > HackerRank' 카테고리의 다른 글

    African Cities, The Report, Top Competitors  (0) 2022.11.15
    African Cities, Average Population of Each Continent, Weather Observation Station 5, Binary Tree Nodes, New Companies  (0) 2022.10.31
    HackerRank - Top Earners,Weather Observation Station 2, 13, 14, 15  (1) 2022.10.03
    Revising Aggregations - Averages,Average Population,Japan Population,Population Density Difference,The Blunder  (0) 2022.09.17
    Employee Salaries,Type of Traingle,The PADS,Revising Aggregations - (The Count Function,The Sum Function)  (0) 2022.09.12

    댓글

    이 글 공유하기

    • 구독하기

      구독하기

    • 카카오톡

      카카오톡

    • 라인

      라인

    • 트위터

      트위터

    • Facebook

      Facebook

    • 카카오스토리

      카카오스토리

    • 밴드

      밴드

    • 네이버 블로그

      네이버 블로그

    • Pocket

      Pocket

    • Evernote

      Evernote

    다른 글

    • African Cities, The Report, Top Competitors

      African Cities, The Report, Top Competitors

      2022.11.15
    • African Cities, Average Population of Each Continent, Weather Observation Station 5, Binary Tree Nodes, New Companies

      African Cities, Average Population of Each Continent, Weather Observation Station 5, Binary Tree Nodes, New Companies

      2022.10.31
    • HackerRank - Top Earners,Weather Observation Station 2, 13, 14, 15

      HackerRank - Top Earners,Weather Observation Station 2, 13, 14, 15

      2022.10.03
    • Revising Aggregations - Averages,Average Population,Japan Population,Population Density Difference,The Blunder

      Revising Aggregations - Averages,Average Population,Japan Population,Population Density Difference,The Blunder

      2022.09.17
    다른 글 더 둘러보기

    정보

    쿄코코 블로그의 첫 페이지로 이동

    쿄코코

    • 쿄코코의 첫 페이지로 이동

    검색

    메뉴

    • 홈

    카테고리

    • 분류 전체보기 (168)
      • Python (24)
        • 😈 99클럽 코테 스터디 4기 TIL (23)
        • 궁금한거 정리 (1)
      • SQL (16)
        • HackerRank (15)
      • [백준] Python,Java로 풀기📖 (71)
        • 정렬(Sorting) (6)
        • 그리디 (5)
        • 문자열 (7)
        • 수학 (3)
        • DFS&BFS (10)
        • 구현 (4)
        • 다이나믹 (17)
        • 이분탐색 (1)
        • 자료구조 (10)
        • 최단거리 (5)
        • 인덱스트리 (0)
      • [프로그래머스]Python,Java로 풀기 (6)
        • Level 1 (4)
        • Level 2 (2)
      • Study Platform📚 (25)
        • (운영체제) - 블로그 및 강의 참고 (0)
        • 김영한👨🏻‍🏫의 스프링 부트와 JPA 실무 완전 .. (5)
        • (알고리즘)- [이코테] 이것이 코딩테스트다 정리 (10)
        • 그림으로 배우는 Http&Network Basic (10)
      • 까먹을까봐 적는 것들 (4)
      • 테스트 보고 난 후..🤔 (0)
      • kt 에이블스쿨 (18)

    최근 글

    인기 글

    댓글

    공지사항

    아카이브

    태그

    • 프로그래머스
    • 코딩테스트준비
    • 오블완
    • TiL
    • 99클럽
    • 백준
    • 티스토리챌린지
    • 항해99

    나의 외부 링크

    정보

    쿄코코의 쿄코코

    쿄코코

    쿄코코

    블로그 구독하기

    • 구독하기
    • RSS 피드

    방문자

    • 전체 방문자
    • 오늘
    • 어제

    티스토리

    • 티스토리 홈
    • 이 블로그 관리하기
    • 글쓰기
    Powered by Tistory / Kakao. © 쿄코코. Designed by Fraccino.

    티스토리툴바