본문 바로가기

Algorithm

(131)
[해커랭크(Hacker Rank)] Type of Triangle (MySQL) 문제 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 3sides of equal length. Isosceles: It's a triangle with 2sides of equal length. Scalene: It's a triangle with 3sides of differing lengths. Not A Triangle: The given values of A, B, and C do..
[해커랭크(Hacker Rank)] Top Earners (MySQL) 문제 We define an employee's total earnings to be their monthly salary * months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as space-separated integers. 코드 SELECT * FR..
[해커랭크(Hacker Rank)] Weather Observation Station 4 (MySQL) 문제 Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table. The STATION table is described as follows: where LAT_N is the northern latitude and LONG_W is the western longitude. 코드 SELECT COUNT(city) - COUNT(DISTINCT(city)) FROM station 풀이 전체 city에서 중복되지 않는 city값 빼기 = 중복되는 city 수 city의 총 개수를 세고 city 이름들을 중복하지 않게 세서 차이를 보고 싶다 출처
[해커랭크(Hacker Rank)]Population Density Difference (MySQL) 문제 Query the difference between the maximum and minimum populations in CITY. Input Format The CITY table is described as follows: 코드 SELECT MAX(population) - MIN(population) FROM city 풀이 1. population의 최댓값과 최소값 빼기 출처