본문 바로가기

데이터/SQL 문제풀이29

HackerRank SQL - SQL Project Planning You are given a table, Projects, containing three columns: Task_ID, Start_Date and End_Date. It is guaranteed that the difference between the End_Date and the Start_Date is equal to 1 day for each row in the table. If the End_Date of the tasks are consecutive, then they are part of the same project. Samantha is interested in finding the total number of different projects completed. Write a query.. 2023. 2. 2.
HackerRank SQL - Contest Leaderboard You did such a great job helping Julia with her last coding contest challenge that she wants you to work on this one, too! The total score of a hacker is the sum of their maximum scores for all of the challenges. 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 b.. 2023. 1. 31.
HackerRank SQL - Ollivander's Inventory Harry Potter and his friends are at Ollivander's with Ron, finally replacing Charlie's old broken wand. 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 .. 2023. 1. 29.
HackerRank SQL - Challenges Julia asked her students to create some coding challenges. Write a query to print the hacker_id, name, and the total number of challenges created by each student. Sort your results by the total number of challenges in descending order. If more than one student created the same number of challenges, then sort the result by hacker_id. If more than one student created the same number of challenges .. 2023. 1. 29.
HackerRank SQL - Draw The Triangle 1, 2 P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5): * * * * * * * * * * * * * * * Write a query to print the pattern P(20). Problem 패턴 P(20)을 출력하는 쿼리을 작성하라. (패턴 P는 행의 갯수만큼 '*'를 반복해서 출력함) Answer1 WITH RECURSIVE my_cte AS ( SELECT 1 AS n UNION ALL SELECT 1+n FROM my_cte WHERE n 2023. 1. 25.
HackerRank SQL - Top Competitors Julia just finished conducting a coding contest, and she needs your help assembling the leaderboard! Write a query to print the respective hacker_id and name of hackers who achieved full scores for more than one challenge. Order your output in descending order by the total number of challenges in which the hacker earned a full score. If more than one hacker received full scores in same number of.. 2023. 1. 24.
HackerRank SQL - The Report You are given two tables: Students and Grades. Students contains three columns ID, Name and Marks. Grades contains the following data: Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. .. 2023. 1. 18.
HackerRank SQL - Weather Observation Station 19 Consider and to be two points on a 2D plane where are the respective minimum and maximum values of Northern Latitude (LAT_N) and are the respective minimum and maximum values of Western Longitude (LONG_W) in STATION. Query the Euclidean Distance between points and and format your answer to display decimal digits. Input Format The STATION table is described as follows: where LAT_N is the northern.. 2023. 1. 12.