본문 바로가기

MYSQL94

Draw The Triangle 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).내 코드WITH RECURSIVE TEMP AS( SELECT 1 as n UNION ALL SELECT n + 1 FROM TEMP WHERE n 처음에 n 2025. 4. 13.
Draw The Triangle 1과 Repeat 함수 문제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).P(R)은 줄리아가 그린 R개 행의 패턴을 나타낸다. P(5) 다음처럼 나타난다. P(20)을 쿼리하라 우선 여기서 처음보는 함수가 나왔다. Repeat이란 함수다. REPEAT 함수는 문자열을 여러번 반복할 때 쓰는 함수다. 프로토타입REPEAT(str, count)문자열 str을 count번 할 때 쓰이는 함수다.  📌 예시:SELECT REPEAT('* ', 5); 🟰 결과:* * * * *SELECT REPE.. 2025. 4. 13.
The Blunder 와 Replace 문제Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's  key was broken until after completing the calculation. She wants your help finding the difference between her miscalculation (using salaries with any zeros removed), and the actual average salary.Write a query calculating the amount of error (i.e.:  av.. 2025. 4. 5.
Occupations 과 Pivot 테이블 문제Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output should consist of four columns (Doctor, Professor, Singer, and Actor) in that specific order, with their respective names listed alphabetically under each column.OCCUPATIONS 테이블에서 Occupation(직업) 컬럼을 피벗(Pivot) 하여, 각 이름(Name)을 해당 직업 아래에 정렬하여 표시하시.. 2025. 4. 3.
Higher Than 75 Marks 문제Query the Name of any student in STUDENTS who scored higher than  75 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.점수가 75점이 넘는 학생들 이름을 쿼리하라.  출력 결과는 각 이름의 마지막 세글자를 기준으로 정력하라. 만약 두명이상의 학생 이름이 같은 세 글자로 끝날 경우, ID를 기준으로 오름차순 정렬하라. SE.. 2025. 4. 3.
들어가기전 HakerRank Easy는 정말 쉽다. 그래서 풀다가 조금 막히는 부분만 올리겠다. 2025. 4. 2.