본문 바로가기

MySQL13

[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.
[SQL] 해커랭크 HackerRank 문제 풀이 Employee Names 정답 문제Write a query that prints a list of employee names (i.e.: the name attribute) from the Employee table in alphabetical order. employee 테이블에서  이름(name)을 알피벳 순으로 출력하라 정답select namefrom employeeorder by name; 배운 점기본적으로 order by 는 asc 오름차순이다 따라서 디폴트가 asc니까 굳이 안 적어도 된다. 2025. 3. 9.
[SQL] 해커랭크 HackerRank 문제 풀이 Higher Than 75 Marks [SQL] hakerrank 문제 풀이문제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. 한국어 버전STUDENTS 테이블에서 75점보다 점수가 높은 학생의 Name 출력하라.각 이름의 마지막 3개 문자로 정렬하라.만약 마지막 3개 문자 이름이 같다면 ID를 .. 2025. 3. 8.
[SQL] HackerRank 해커랭크 문제 풀이 Weather Observation Station 12 문제 Query the list of CITY names from STATION that do not start with vowels and do not end with vowels. Your result cannot contain duplicates.  다음 SQL 쿼리는 STATION 테이블에서 CITY 이름을 조회하는데, 다음 조건을 만족하는 경우만 선택합니다.CITY 이름이 모음(a, e, i, o, u)으로 시작하지 않는다.CITY 이름이 모음(a, e, i, o, u)으로 끝나지 않는다.결과에서 중복을 제거한다. 정답select distinct cityfrom stationwhere city not regexp '^[AEUIO]' and city not regexp '[AEUIO]$'  추가 .. 2025. 3. 7.
[SQL] HackerRank Weather Observation Station 11 hankerrank 문제풀이 정답 문제STATION 테이블에서 도시(CITY) 이름을 조회하는데, 아래 두 조건 중 하나라도 만족하는 도시만 가져와야 한다.또한, 중복된 도시 이름은 제거해야 한다.조건:도시 이름이 모음(A, E, I, O, U)으로 시작하지 않는 경우도시 이름이 모음(A, E, I, O, U)으로 끝나지 않는 경우정답select distinct cityfrom stationwhere city not regexp '^[AEUIO]' or city not regexp '[AEUIO]$'; 2025. 3. 6.