example of coalesce operatorexample give the


Example of COALESCE operator

Example: Give the total of marks for each exam (simplified solution)

SELECT CourseId,

COALESCE ((SELECT SUM (Mark)

FROM EXAM_MARK AS EM

WHERE EM.CourseId = C.CourseId ),

 0) AS TotalMark

FROM COURSE AS C

Explanation

  • The first operand to the invocation of COALESCE is a scalar subquery similar to Aggregate Operators. Recall the need to enclose the SELECT expression in parentheses, without which it would denote a table rather than a number.

Request for Solution File

Ask an Expert for Answer!!
PL-SQL Programming: example of coalesce operatorexample give the
Reference No:- TGS0180867

Expected delivery within 24 Hours