The qualification
The SQL qualification restricts the set of rows returned to the user. The qualification filters out records that are not interesting. Only the records that pass the qualification are evaluated in the target list. Thus, a qualification is a more powerful tool than the target list.
A single expression in a qualification is called a predicate. A qualification can contain multiple predicates joined by the Boolean operators AND and OR.
If a DataBlade® module routine is used in a qualification, it filters the records returned to the client. Your database server can filter by the contents of new data types. (This capability is not available in conventional relational databases.)
Consider whether the routines you define are more likely to be used in the target list or the qualification. Routines more commonly used in the qualification make better use of the extensibility of your database server because they support searches that cannot be done efficiently on conventional relational servers.
SELECT name, boundary FROM cities WHERE
Overlaps(boundary, '(1,1), (5,5), (7,7), (8,9)');
In this example, the Overlaps() routine is provided
by the SimpleMap DataBlade module
and takes two polygon arguments: the first argument specifies the
polygon you are checking; the second specifies the polygon with which
the first is compared. Overlaps() returns TRUE
if
the two polygons overlap and FALSE
otherwise. This
query searches the cities table for those cities that overlap
the region of interest.
SELECT name, population FROM cities
WHERE Area(boundary) > 500;
In this example, the Area() routine appears in the qualification. In the section ids_dbdk_029.html#ids_dbdk_029, the Area() routine appeared in the target list.
SELECT Overlaps(boundary, '(1,1), (5,5), (7,7), (8,9)')
FROM cities;
SELECT a.name, Overlaps(a.boundary, b.boundary)
FROM cities a, cities b
WHERE b.name = 'Los Angeles' AND
a.name = b.name;
This query returns a list of all cities in the table and whether they overlap Los Angeles.
- What questions do users want to ask about the contents of the new data types in the DataBlade module?
- What routines allow them to ask those content-based questions? These routines are used in the qualification.