4.3.2 REGISTER QUERY clause (query definition)

Organization of this subsection
(1) Format
(2) Function
(3) Operands
(4) Syntax rules
(5) Notes
(6) Usage example

(1) Format

REGISTER QUERY::=REGISTER[Figure]QUERY[Figure]query-name[Figure]inquiry

(2) Function

Defines a query.

This clause registers a query to the query management table (part of the query repository), and begins query processing.

(3) Operands

query-name

Specify any query name that is unique within the stream data processing system. For details about specifying names, see 3.2.4 Specifying names.

The name specified here becomes the name of the stream returned by an inquiry (output stream) or a relation.

inquiry

Defines an inquiry. For details about definitions, see 4.4.1 Inquiry.

(4) Syntax rules

Specify all inquiries for a single query in a single definition. For example, when defining a query q1, specify all of the necessary inquiries as shown in Example 1.

Example 1 (correct specification example):

REGISTER QUERY q1 SELECT s1.a, s1.b FROM s1[ROWS 10];

If the inquiries are divided and specified for the query q1, as shown in Example 2, two queries with the same name end up being specified, resulting in an error.

Example 2 (incorrect specification examples)

REGISTER QUERY q1 SELECT s1.a FROM s1[ROWS 10];
REGISTER QUERY q1 SELECT s1.b FROM s1[ROWS 10];

(5) Notes

None.

(6) Usage example

Defines a query q1 that outputs data from column a of stream s1.

REGISTER QUERY q1 SELECT s1.a FROM s1[ROWS 10];