본문 바로가기

쿼리문제7

[SQL] 해커랭크 HackerRank Placements 문제 풀이 문제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).Write a query to output the names of those students whose best friends got offered a higher salary than them. Names must be orde.. 2025. 3. 16.
[SQL] 해커랭크 HackerRank 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. 3. 15.
[SQL] 해커랭크 HackerRank 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는 이진 트리(Binary .. 2025. 3. 14.
[SQL] 해커랭크 HackerRank 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. 3. 12.
[SQL] 해커랭크 HackerRank 문제 풀이 Type of Triangle - Advanced Select 문제Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table:Equilateral: It's a triangle with  sides of equal length.Isosceles: It's a triangle with  sides of equal length.Scalene: It's a triangle with  sides of differing lengths.Not A Triangle: The given values of A, B, and C don't f.. 2025. 3. 11.
[SQL] 해커랭크 HackerRank 문제 풀이 Employee Salaries 문제 Employee SalariesWrite a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than $2000 per month who have been employees for less than 10 months. Sort your result by ascending employee_id. where employee_id is an employee's ID number, name is their name, months is the total number of months they've been working for the compa.. 2025. 3. 10.