COALESCE : null이 아닌 첫번째 값 반환
형식
SELECT COALESCE(Column명, Column명이 NULL인 경우 대체할 값)
FROM 테이블명
# Column1 ~ 4 중 NULL이 아닌 첫 번째 Column을 출력
SELECT COALESCE(Column명1, Column명2, Column명3, Column명4)
FROM 테이블명
예시
리트코드 문제
2023.01.15 - [Data Analytics/CodingTest] - [leetcode] 577. Employee Bonus / COALESCE
[leetcode] 577. Employee Bonus / COALESCE
577. Employee Bonus https://leetcode.com/problems/employee-bonus/ Employee Bonus - LeetCode Can you solve this real interview question? Employee Bonus - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and
dataanalysisdot.tistory.com
'🛠️Skill > SQL' 카테고리의 다른 글
[SQL문법] WHERE 조건절과 JOIN의 ON의 차이점 (0) | 2023.03.09 |
---|---|
[SQL문법] UNION, UNION ALL / 친구가 가장 많은 사람 구하기 - 602. Friend Requests II (0) | 2023.01.17 |
[SQL문법] SET 변수 사용하기 / MySQL (0) | 2023.01.05 |
[SQL 문제] 요일별 매출액, 최초/마지막 주문일, 요일별 매출액 평균 (0) | 2022.12.15 |
[SQL문법] GROUP_CONCAT 그룹별 집계 (0) | 2022.12.14 |
댓글