본문 바로가기

데이터 분석68

Weather Observation Station 11 (HackerRank) Weather Observation Station 11 | HackerRank Query a list of CITY names not starting or ending with vowels. www.hackerrank.com 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. 풀이 제출한 답 select distinct city from station where city not regexp '^[aeiou].*[aeiou]$' -> .은 어떤 문자든 일치, *은 문자를 여러 번 반복 2022. 11. 6.
Ollivander's Inventory (HackerRank) Ollivander's Inventory | HackerRank Help pick out Ron's new wand. www.hackerrank.com Hermione decides the best way to choose is by determining the minimum number of gold galleons needed to buy each non-evil wand of high power and age. Write a query to print the id, age, coins_needed, and power of the wands that Ron's interested in, sorted in order of descending power. If more than one wand has s.. 2022. 11. 5.
SQL Project Planning (HackerRank) SQL Project Planning | HackerRank Write a query to output the start and end dates of projects listed by the number of days it took to complete the project in ascending order. www.hackerrank.com Write a query to output the start and end dates of projects listed by the number of days it took to complete the project in ascending order. If there is more than one project that have the same number of .. 2022. 11. 4.
Binary Tree Nodes (HackerRank) Binary Tree Nodes | HackerRank Write a query to find the node type of BST ordered by the value of the node. www.hackerrank.com Write a query to find the node type of Binary Tree ordered by the value of the node. Output one of the following for each node: 풀이 제출한 답 select N, (case when p is null then 'Root' when N in (select p from bst) then 'Inner' else 'Leaf' end) from bst order by N -> P에 있는 값이.. 2022. 11. 3.
Weather Observation Station 5 (HackerRank) Weather Observation Station 5 | HackerRank Write a query to print the shortest and longest length city name along with the length of the city names. www.hackerrank.com Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there is more than one smallest or largest city, choose the one that comes .. 2022. 10. 12.
Occupations (HackerRank) Occupations | HackerRank Pivot the Occupation column so the Name of each person in OCCUPATIONS is displayed underneath their respective Occupation. www.hackerrank.com Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output column headers should be Doctor, Professor, Singer, and Actor, respectively. 풀이.. 2022. 10. 11.
[SQL&Python] 실전 맨땅에 EDA 데이터를 잘 다루기 위해서는 어디에, 어떤 데이터가 있는지 속속들이 파악하는 것이 먼저인 것 같다는 생각이 드는 요즘. 이런 걸 EDA라고 멋들어지게 말하던데 화려한 시각화까지는 아니더라도 나만의 EDA 방법을 매뉴얼화 해보려고 한다. (언제나 그렇듯 근본없음. 내가 보려고 만듦. 그리고 약간의 파이썬을 곁들인..) 1. 요구사항 정의 우리 쇼핑몰에서는 단가가 높은 상품이 많이 나가는지, 단가가 낮은 상품 위주로 판매되는지 알고 싶다는 니즈에서 출발해본다. 먼저 위와 같이 자연어로 이루어진 요구사항을 데이터 추출에 용이한 문장으로 재작성한다. 예시로 든 상황에서도 오해의 소지가 많은데 가령 가장 많이 팔린 상품의 판매가를 말하는 건지, 전체 주문 상품 판매가의 평균을 말하는 건지 등 다양한 의미로 해석될.. 2022. 10. 8.
New Companies (HackerRank) New Companies | HackerRank Find total number of employees. www.hackerrank.com Given the table schemas below, write a query to print the company_code, founder name, total number of lead managers, total number of senior managers, total number of managers, and total number of employees. Order your output by ascending company_code. 풀이 제출한 답 select c.company_code, c.founder, (select count(distinct Le.. 2022. 10. 5.
Contest Leaderboard (HackerRank) Contest Leaderboard | HackerRank Generate the contest leaderboard. www.hackerrank.com Write a query to print the hacker_id, name, and total score of the hackers ordered by the descending score. If more than one hacker achieved the same total score, then sort the result by ascending hacker_id. Exclude all hackers with a total score of 0 from your result. 풀이 제출한 답 with sub as( select hacker_id, ch.. 2022. 10. 4.
Weather Observation Station 17 (HackerRank) Weather Observation Station 17 | HackerRank Query the Western Longitude for the smallest value of the Northern Latitudes greater than 38.7780 in STATION and round to 4 decimal places. www.hackerrank.com 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. 풀이 제출한 답 select round(LONG_W, 4) from .. 2022. 9. 29.