본문 바로가기
🛠️Skill/SQL

[SQL문법] COALESCE : null이 아닌 첫번째 값 반환

by Istj_eff 2023. 1. 10.

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

 

댓글