WHERE

The query languages allows defining simple filters as well as existential filters. A simple filter is a filter that compares a single field to a constant expression, or a constant expression to another (in that case, the expression is evaluated immediately and actual query execution will not happen if, e.g., the predicate evaluates to false).

Syntax

WHERE booleanExpression

Parameter

  • booleanExpression

    A Boolean expression. If true, the row should be included. If false or NULL, the row should not be included.

Examples

Single predicate

Suppose that we want to filter all restaurants from the example above whose rest_no is larger or equal to 44:

select rest_no, name from restaurant where rest_no >= 44;

will return:

rest_no

name

44

Restaurant3

45

Restaurant4

Multiple predicates

It is also possible to have a conjunction of predicates, say we want to view restaurants whose rest_no is between 43 and 45

select rest_no, name from restaurant where rest_no > 43 and rest_no < 45;

will return

rest_no

name

44

Restaurant3