본문 바로가기

데이터/SQL 문제풀이29

HackerRank SQL - 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 dupl.. 2023. 1. 9.
HackerRank SQL - Occupations Pivot the Occupation column in OCCUPATIONS so that each Name is sorted alphabetically and displayed underneath its corresponding Occupation. The output column headers should be Doctor, Professor, Singer, and Actor, respectively. Note: Print NULL when there are no more names corresponding to an occupation. Input Format The OCCUPATIONS table is described as follows: Occupation will only contain on.. 2023. 1. 6.
HackerRank SQL - 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.. 2023. 1. 3.
Weather Observation Station 18 Consider and to be two points on a 2D plane. happens to equal the minimum value in Northern Latitude (LAT_N in STATION). happens to equal the minimum value in Western Longitude (LONG_W in STATION). happens to equal the maximum value in Northern Latitude (LAT_N in STATION). happens to equal the maximum value in Western Longitude (LONG_W in STATION). Query the Manhattan Distance between points and.. 2022. 11. 15.
HackerRank SQL - Type of Triangle 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 fo.. 2022. 11. 15.
HackerRank SQL - Higher Than 75 Marks Query the Name of any student in STUDENTS who scored higher than 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. Input Format The STUDENTS table is described as follows: The Name column only contains uppercase (A-Z) and lowercase (a.. 2022. 11. 1.
HackerRank SQL - The Blunder 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.: avera.. 2022. 11. 1.
[MySQL] HackerRank SQL - Weather Observation Station 10 Problem Query the list of CITY names from STATION that do not end with vowels. Your result cannot contain duplicates. Input Format The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. STATION의 테이블에서 모음으로 끝나지 않는 CITY명만 출력하라. 단, 중복은 제외하라. Answer1 SELECT CITY FROM STATION WHERE RIGHT(CITY,1) NOT IN ('a','e','i','o','u') GROUP BY CITY H.. 2022. 10. 20.