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

쿄코코

페이지 맨 위로 올라가기

쿄코코

얼레벌레 생활🤯

HackerRank- Weather Observation Station 10,11,12,Higher Than 75 Marks,Employee Names

  • 2022.09.12 04:15
  • SQL/HackerRank
    반응형

    Weather Observation Station 10📝

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

     

    ➡️ STATION 테이블, 조건 : a,e,i,o,u로 끝나지 않는 city 이름 -> 출력 : 중복되지 않는 city 

    -> Weather Observation Station 7번(이전게시물) 에 not 또는 ^을 붙인다.

    Query the list of CITY names from STATION that 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 NOT (city LIKE '%a'
          OR city LIKE '%e'
          OR city LIKE '%i'
          OR city LIKE '%o'
          OR city LIKE '%u');
    SELECT DISTINCT city
    FROM station
    WHERE city REGEXP '[^aeiou]$';

     


     

    Weather Observation Station 11📝

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

     

    ➡️ STATION 테이블, 조건 : a,e,i,o,u로 끝나지 않는 city 이름 -> 출력 : 중복되지 않는 city

    -> Weather Observation Station 8번(이전게시물) 에 ^을 붙인다.

    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 REGEXP '^[^aeiou]' OR city REGEXP '[^aeiou]$';

     


     

    Weather Observation Station 12📝

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

     

    ➡️ STATION 테이블, 조건 : a,e,i,o,u로 끝나지 않는 city 이름 -> 출력 : 중복되지 않는 city

    -> Weather Observation Station 8번(이전게시물) 에 ^을 붙인다.위와 다른 점은 and, or의 차이다. 

    Query the list of CITY names from STATION that do not start with vowels and 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 REGEXP '^[^aeiou].*[^aeiou]$';

     


     

    Higher Than 75 Marks📝

    https://www.hackerrank.com/challenges/more-than-75-marks/problem?isFullScreen=true 

     

    ➡️ STUDENTS 테이블,조건 : marks>75보다 큰 값 출력 -> 출력 시 : 뒤에 세글자로 정렬 (ex.Ashley,Julia,Belvet ),2순위 정렬 조건 : ID

    Query the Name of any student in STUDENTS who scored higher than  Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.

    Input Format

    The STUDENTS table is described as follows: 

     The Name column only contains uppercase (A-Z) and lowercase (a-z) letters.

    Sample Input

    Sample Output

    Ashley
    Julia
    Belvet
    

    Explanation

    Only Ashley, Julia, and Belvet have Marks > . If you look at the last three characters of each of their names, there are no duplicates and 'ley' < 'lia' < 'vet'.

    #MySQL
    SELECT name 
    FROM students 
    WHERE marks>75 
    ORDER BY RIGHT(name,3),ID;--mysql에서는 SUBSTRING,RIGHT,LEFT
    
    SELECT name 
    FROM students 
    WHERE marks>75 
    ORDER BY SUBSTRING(name,-3),ID;
    
    #Oracle
    SELECT name
    FROM students
    WHERE marks>75
    ORDER BY SUBSTR(name,-3),ID;--오라클에서는 SUBSTR,오라클에서는 left,right가 존재하지 않음

     


     

    Employee Names📝

    https://www.hackerrank.com/challenges/name-of-employees/problem?isFullScreen=true 

     

    ➡️ Employee 테이블-> 출력 : name column 출력, ORDER BY name column

    Write a query that prints a list of employee names (i.e.: the name attribute) from the Employee table in alphabetical order.

    Input Format

    The Employee table containing employee data for a company is described as follows: 

    where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the company, and salary is their monthly salary.

    Sample Input

    Sample Output

    Angela
    Bonnie
    Frank
    Joe
    Kimberly
    Lisa
    Michael
    Patrick
    Rose
    Todd
    SELECT name
    FROM employee
    ORDER BY name;

     

    반응형

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

    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
    HackerRank- Weather Observation Station 6,7,8,9  (0) 2022.09.04
    HackerRank-Japanese Cities' Attributes, Japanese Cities' Names, Weather Observation Station 1, Weather Observation Station 3, Weather Observation Station 4 (COUNT(*))  (0) 2022.08.28
    HackerRank - Revising the Select Query I, Revising the Select Query II, Select All, Select By ID  (0) 2022.08.23

    댓글

    이 글 공유하기

    • 구독하기

      구독하기

    • 카카오톡

      카카오톡

    • 라인

      라인

    • 트위터

      트위터

    • Facebook

      Facebook

    • 카카오스토리

      카카오스토리

    • 밴드

      밴드

    • 네이버 블로그

      네이버 블로그

    • Pocket

      Pocket

    • Evernote

      Evernote

    다른 글

    • 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
    • Employee Salaries,Type of Traingle,The PADS,Revising Aggregations - (The Count Function,The Sum Function)

      Employee Salaries,Type of Traingle,The PADS,Revising Aggregations - (The Count Function,The Sum Function)

      2022.09.12
    • HackerRank- Weather Observation Station 6,7,8,9

      HackerRank- Weather Observation Station 6,7,8,9

      2022.09.04
    • HackerRank-Japanese Cities' Attributes, Japanese Cities' Names, Weather Observation Station 1, Weather Observation Station 3, Weather Observation Station 4 (COUNT(*))

      HackerRank-Japanese Cities' Attributes, Japanese Cities' Names, Weather Observation Station 1, Weather Observation Station 3, Weather Observation Station 4 (COUNT(*))

      2022.08.28
    다른 글 더 둘러보기

    정보

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

    쿄코코

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

    검색

    메뉴

    • 홈

    카테고리

    • 분류 전체보기 (172) N
      • 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📚 (28) N
        • 김영한👨🏻‍🏫의 스프링 부트와 JPA 실무 완전 .. (5)
        • (알고리즘)- [이코테] 이것이 코딩테스트다 정리 (10)
        • 그림으로 배우는 Http&Network Basic (10)
        • AWS SAA C03공부하기 (3) N
      • 까먹을까봐 적는 것들 (5)
      • 테스트 보고 난 후..🤔 (0)
      • kt 에이블스쿨 (18)

    최근 글

    인기 글

    댓글

    공지사항

    아카이브

    태그

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

    나의 외부 링크

    정보

    쿄코코의 쿄코코

    쿄코코

    쿄코코

    블로그 구독하기

    • 구독하기
    • RSS 피드

    방문자

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

    티스토리

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

    티스토리툴바