SQL 5

[SQL] leetCode Department Top Three Salaries

https://leetcode.com/problems/department-top-three-salaries/ Department Top Three Salaries - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 부서별로 연봉순위 3위까지 출력하는 문제입니다. 단 동일한 연봉인 경우 동일 순위로 판단합니다. (1등이 2명이더라도 다음 순위는 2등으로 판별) DENSE RANK 함수를 사용하였습니다. [Oracle 풀이] SELECT D.NAME AS Depart..

[SQL] leetcode Second Highest Salary

https://leetcode.com/problems/second-highest-salary/ Second Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 두번째로 연봉이 높은 직원을 출력하는 문제입니다. 풀이 : rank over 윈도우 함수 사용 [Oracle 풀이] select sum(salary) as "SecondHighestSalary" from ( select salary, rank() over (order by sala..

[SQL] leetcode Trips and Users

문제 : https://leetcode.com/problems/trips-and-users/ Trips and Users - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com banned된 고객이 신청한게 아닌 예약들 중에 취소된 비율을 구하는 문제입니다. 오라클 Oracle 풀이 SELECT request_at as Day ,round(COUNT(case status when 'cancelled_by_driver' then 1 when 'cancelled_by_c..

프로그래머스 SQL 고득점 Kit 문제 모음 2

IS NULL 이름이 없는 동물의 ID : https://programmers.co.kr/learn/courses/30/lessons/59039 SELECT ANIMAL_ID FROM ANIMAL_INS WHERE NAME IS NULL ORDER BY ANIMAL_ID; 이름이 있는 동물의 ID : https://programmers.co.kr/learn/courses/30/lessons/59407 SELECT ANIMAL_ID FROM ANIMAL_INS WHERE NAME IS NOT NULL ORDER BY ANIMAL_ID; NULL 처리하기 : https://programmers.co.kr/learn/courses/30/lessons/59410 [ORACLE] SELECT ANIMAL_TYPE..

프로그래머스 SQL 고득점 Kit 문제 모음 1

SELECT 모든 레코드 조회하기 : https://programmers.co.kr/learn/courses/30/lessons/59034 SELECT * FROM ANIMAL_INS ORDER BY ANIMAL_ID; 역순 정렬하기 : https://programmers.co.kr/learn/courses/30/lessons/59035 SELECT NAME, DATETIME FROM ANIMAL_INS ORDER BY ANIMAL_ID DESC; 아픈 동물 찾기 : https://programmers.co.kr/learn/courses/30/lessons/59036 SELECT animal_id, name FROM animal_ins WHERE intake_condition = 'sick' ORDER ..