SAP HANA SQL Expression Tutorial

SQL Expressions is a clause that can be used for return values. There are 4 types of SQL Expressions-

  • Case Expressions – In this expression the user can use IF – THEN – ELSE logic without write procedure.
  • Function Expressions – SQL built-in-functions can be used as Expressions.
  • Aggregate Expressions – In This Expression aggregate functions is used to calculate a single value from the values of multiple rows for a column.
Aggregate Name Description
COUNT Count the Number of rows returned by the query.
MIN Return the minimum value of the expression.
MAX Return the maximum value of the expression.
SUM Return the sum of expressions.
AVG Return the arithmetical mean of expressions.
STDDEV Return the Standard Deviation of given expressions as the square root of VARIANCE function.
VAR Return the variance of expressions as the square of standard deviation
  • Subqueries in Expression – A subquery is a select statement enclosed in parentheses and used in a main select statement as input.