본문 바로가기

MYSQL/HakerRank_Medium16

New Companies Amber's conglomerate corporation just acquired some new companies. Each of the companies follows this hierarchy: 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.Note:The tables may contain dupli.. 2025. 4. 15.
Binary Tree Nodes 문제You are given a table, BST, containing two columns: N and P, where N represents the value of a node in Binary Tree, and P is the parent of N. 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:Root: If node is root node.Leaf: If node is leaf node. Inner: If node is neither root nor leaf node. BST라는 테이블이 주어지며, 이 테이블에는 N.. 2025. 4. 14.
The PADS 문제Generate the following two result sets:Query an alphabetically ordered list of all names in OCCUPATIONS, immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses). For example: AnActorName(A), ADoctorName(D), AProfessorName(P), and ASingerName(S).Query the number of ocurrences of each occupation in OCCUPATIONS. Sort the occurrences in ascend.. 2025. 4. 14.
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.