Creating SQL Filter Expressions

SQL (Structured Query Language) filter expressions enable you to access data in relational database management systems by enabling you to select the data you want to work with. For example, in Vector Asset Management SQL is used to select the Clients that appear in dynamic groups. This ensures that when a change, such as the installation of Adobe Acrobat, is made to a Client PC, it is automatically included in a dynamic group that contains Clients where Acrobat is installed.

The SELECT statement forms the basis of filter expressions. It is used to query the database and retrieve selected data that match criteria you specify. When selecting Clients for a dynamic group, the filter expression begins with the SELECT statement. For example:

SELECT * FROM NODES

selects all (*) the Clients stored in the NODES table of the Site database.

The SELECT statement can be modified by clauses that enable you to choose the data you want to work with.

FROM specifies the location of the data you want to select from

WHERE adds criteria that enable you to identify the data you want to use. For example, select all Clients that belong to the Sales Department:

SELECT * FROM NODES WHERE DEPT LIKE 'sales%'

Comparison operators enable you to identify the data you want to select from within a database. The following table lists the comparison operators you can use in SQL expressions:

Operator

Description

=

Equal to

<>

Not equal to

<

Less than

>

Greater than

<=

Less than or equal to

>=

Greater than or equal to

LIKE

A more flexible version of equal to. The percent symbol ( % ) is used to represent any possible character (number, letter, or punctuation), or set of characters, which might appear before or after a given character. For example, to find Clients with Departments beginning with A, such as ADMIN and ACCOUNTS, use 'A%'. The percent symbol can be used to represent any characters in the same position relative to the given characters:

SELECT * FROM NODES WHERE DEPT LIKE 'A%'

 

Related Topics

Combining Data from Multiple Tables

Database Schema

Example Filter Expressions

Logical and Compound Operators

Using Dates in Filter Expressions