What are the syntax and use of the COALESCE function?

0

The COALESCE() function evaluates the arguments in sequence and returns the first NON-NULL value in a specified number of expressions. If it evaluates arguments as NULL or not found any NON-NULL value, it returns the NULL result.

The syntax of COALESCE function is given below:

  1. COALESCE (exp1, exp2, .... expn)

Example:

  1. SELECT COALESCE(NULL, 'Hello', 'Javatpoint', NULL) AS Result;

This statement will return the following output:

Sql
asked Apr 14, 2023 at 22:17
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.