Example of coalesce operator - sql, PL-SQL Programming

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.
Posted Date: 1/18/2013 6:38:57 AM | Location : United States







Related Discussions:- Example of coalesce operator - sql, Assignment Help, Ask Question on Example of coalesce operator - sql, Get Answer, Expert's Help, Example of coalesce operator - sql Discussions

Write discussion on Example of coalesce operator - sql
Your posts are moderated
Related Questions
Understanding Varrays The Items of type VARRAY are termed as the varrays. They permit you to relate a single identifier with the whole collection. This relationship lets you man

Semidifference and NOT - SQL In this section first describe the relational difference operator, named MINUS. Example here shows SQL's closest counterpart of that operator.

Albeit simple method : These all the truth tables give us our first as albeit simple method for proving a theorem: where check whether it can be written in propositional logic

Create a Oracle procedure to produce vertical output format when selecting rows from a database table.

Relational Operators The relational operators permit you to compare randomly complex expressions. The list below provides the meaning of each operator:

Named Notation The second procedure call uses the named notation. An arrow (=>) serve as the relationship operator that associates the formal parameter to the left of the arro

Procedural Constraint Enforcement (Triggers) SQL has an alternative method of addressing database integrity, involving event-driven procedural code. The special procedures th

IF Statement The IF statement executes a series of statement conditionally. Whether the series is executed or not depends on the value of the Boolean expression. Syntax:

Important Distinctions The list of important distinctions are given below: Value versus variable Syntax versus semantics Variable versus variable reference

Projection in SQL - correct version Student StudentId is enrolled on some course. SELECT DISTINCT StudentId FROM IS_ENROLLED_ON In more complicated examples it is someti