본문 바로가기

MYSQL/HakerRank_Medium15

Print Prime Numbers 문제Write a query to print all prime numbers less than or equal to . Print your result on a single line, and use the ampersand (&) character as your separator (instead of a space).For example, the output for all prime numbers would be:1000 보다 작거나 같은 모든 소수를 인쇄하는 쿼리를 작성합니다. 결과를 한 줄에 인쇄하고 공백 대신 앰퍼샌드(&) 문자를 구분 기호로 사용합니다.WITH RECURSIVE numbers AS( SELECT 2 as n UNION ALL SELECT n + 1 FROM num.. 2025. 4. 24.
Symmetric Pairs 과 Self_Join You are given a table, Functions, containing two columns: X and Y.Two pairs (X1, Y1) and (X2, Y2) are said to be symmetric pairs if X1 = Y2 and X2 = Y1.Write a query to output all such symmetric pairs in ascending order by the value of X. List the rows such that X1 ≤ Y1.두 쌍 *(X1, Y1)*과 *(X2, Y2)*는 X1 = Y2이고 X2 = Y1일 때 대칭 쌍이라고 합니다.이러한 모든 대칭 쌍을 X 값의 오름차순으로 출력하는 쿼리를 작성하세요. X1 ≤ Y1인 행들만 나열하세요.SELECT.. 2025. 4. 22.
Placements 과 Join You are given three tables: Students, Friends and Packages. Students contains two columns: ID and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best friend). Packages contains two columns: ID and Salary (offered salary in $ thousands per month). 세 개의 테이블이 주어집니다: Students, Friends, Packages.Students 테이블은 두 개의 열로 구성됩니다: ID와 NameFriends 테이블은 두 개의 열로 구성됩니다: ID와 Friend_ID (유일한 .. 2025. 4. 22.
SQL Project Planning과 Islands and Gaps 패턴 문제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 que.. 2025. 4. 21.
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 .. 2025. 4. 21.
Challenges 와 WITH 절 문제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 challenge.. 2025. 4. 18.