CDS Arithmetic Functions – Ceil, Floor, Div (Integer), Division (Dec), Mod, Round & Aggregate Expressions – MAX, MIN, AVG, SUM, COUNT, Group By Clause, HAVING Clause

0
5

CDS Arithmetic Functions

Ceil, Floor, Div (Integer), Division (Dec), Mod, Round

Ceil is 26 for a number 25.3 while Floor is 25 for the same number 25.3.

Aggregate Expressions

MAX
MIN
AVG
SUM
COUNT

Note:Require a GROUP BY clause when aggregate functions are used along with other elements in the projection list

COUNT

You can calculate the number of rows in the result set using COUNT.

MIN, MAX, SUM

You can calculate the minimum or maximum value in a column.
What is the price range of the flights?

Group By Clause

  • A table can be divided into (disjoint) groups of rows.
  • A group is represented in the query result by a single row.
  • Aggregate expressions will be evaluated separately for each group.
  • Columns outside of aggregate functions must be listed in GROUP BY clause.

Having Condition

  • HAVING condition is evaluated after the group by clause is evaluated.
  • HAVINGcondition can only be specified together withGROUP BY.
  • Aggregate expressions can be specified in the HAVING condition.

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here