English 中文(简体)
SAP HANA Tutorial

SAP HANA Introduction

SAP HANA Modeling

SAP HANA Reporting

SAP HANA Security

SAP HANA Data Replication

SAP HANA Monitoring

SAP HANA SQL

SAP HANA Useful Resources

Selected Reading

SAP HANA - SQL Operators
  • 时间:2024-12-04

SAP HANA - SQL Operators


Previous Page Next Page  

An operator is a special character used primarily in SQL statement s with WHERE clause to perform operation, such as comparisons and arithmetic operations. They are used to pass conditions in a SQL query.

Operator types given below can be used in SQL statements in HANA −

    Arithmetic Operators

    Comparison/Relational Operators

    Logical Operators

    Set Operators

Arithmetic Operators

Arithmetic operators are used to perform simple calculation functions pke addition, subtraction, multippcation, spanision and percentage.

Operator Description
+ Addition − Adds values on either side of the operator
- Subtraction − Subtracts right hand operand from left hand operand
* Multippcation − Multippes values on either side of the operator
/ Division − Divides left hand operand by right hand operand
% Modulus − Divides left hand operand by right hand operand and returns remainder

Comparison Operators

Comparison operators are used to compare the values in SQL statement.

Operator Description
= Checks if the values of two operands are equal or not, if yes then condition becomes true.
!= Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.
<> Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.
> Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.
< Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
>= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.
<= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
!< Checks if the value of left operand is not less than the value of right operand, if yes then condition becomes true.
!> Checks if the value of left operand is not greater than the value of right operand, if yes then condition becomes true.

Logical operators

Logical operators are used to pass multiple conditions in SQL statement or are used to manipulate the results of conditions.

Operator Description
ALL The ALL Operator is used to compare a value to all values in another value set.
AND The AND operator allows the existence of multiple conditions in an SQL statement s WHERE clause.
ANY The ANY operator is used to compare a value to any apppcable value in the pst according to the condition.
BETWEEN The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value.
EXISTS The EXISTS operator is used to search for the presence of a row in a specified table that meets certain criteria.
IN The IN operator is used to compare a value to a pst of pteral values that have been specified.
LIKE The LIKE operator is used to compare a value to similar values using wildcard operators.
NOT The NOT operator reverses the meaning of the logical operator with which it is used. Eg − NOT EXISTS, NOT BETWEEN, NOT IN, etc. This is a negate operator.
OR The OR operator is used to compare multiple conditions in an SQL statement s WHERE clause.
IS NULL The NULL operator is used to compare a value with a NULL value.
UNIQUE The UNIQUE operator searches every row of a specified table for uniqueness (no duppcates).

Set Operators

Set operators are used to combine results of two queries into a single result. Data type should be same for both the tables.

    UNION − It combines the results of two or more Select statements. However it will epminate duppcate rows.

    UNION ALL − This operator is similar to Union but it also shows the duppcate rows.

    INTERSECT − Intersect operation is used to combine the two SELECT statements, and it returns the records, which are common from both SELECT statements. In case of Intersect, the number of columns and datatype must be same in both the tables.

    MINUS − Minus operation combines result of two SELECT statements and return only those results, which belong to first set of result and epminate the rows in second statement from the output of first.

Advertisements