How Do I...

Specify a HAVING clause

Specify a GROUP BY clause No tip for this topic No example for this topic Specify an ORDER BY clause

You can specify a HAVING clause as one of the following:

Specifying an SQL predicate

An SQL predicate is a condition that evaluates to true, false, or unknown.

To specify a HAVING clause that is an SQL predicate:

  1. Specify the left operand of the SQL predicate.
  2. Select the keyword operator of the SQL predicate.
  3. Specify the right operand of the SQL predicate, if any.

Example:

Specifying a logical expression

A logical expression is mathematical condition that evaluates to true, false, or unknown.

To specify a HAVING clause that is a logical expression:

  1. Specify the left operand of the logical expression.
  2. Select the logical operator of the logical expression.
  3. Specify the right operand of the logical expression.

Example:

Specifying a compound logical expression

A compound logical expression is a logical expression that consists of a combination of expressions, SQL predicates, or other logical expressions.

To specify a HAVING clause that is a compound logical expression:

  1. Specify one of the expressions or logical expressions contained in the compound logical expression by following the same steps as for specifying a HAVING clause that is a logical expression.

    If you are specifying an expression, select a binary operator instead of a logical operator when following the steps for specifying a HAVING clause that is a logical expression.

  2. Select Add to operand lists.
  3. Repeat the steps above for each expression or logical expression contained in the compound logical expression.
  4. Specify the left operand of the compound logical expression.
  5. Select the logical operator of the compound logical expression.
  6. Specify the right operand of the compound logical expression.

Example:

(((WAGES.SALARY - WAGES.TAXES) > 3000) AND NOT (EMPLOYEE.AGE < 40))

Specifying an empty expression

To specify a HAVING clause that is an empty expression:

  1. If an operator is specified in the Operator field, select <none> from the list.
  2. If an operand is specified in the Left operand field, delete it.

    The Expression field should now be empty.


[ Top of Page | Previous Page | Next Page | Table of Contents ]