Appendix F - Reading Syntax Diagrams

<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide >

Appendix F - Reading Syntax Diagrams

Previous pageReturn to chapter overviewNext page

What Are Syntax Diagrams?

Syntax diagrams --- sometimes called "railroad diagrams" --- show the required parts of a SQLstream command as boxed elements connected by arrows along the main horizontal line, as if that line represented a straight railroad track. Every element shown along that line must appear in the command as written unless there a vertical arrow leading to an optional "path" around some element.

For example:

dropPump

The DROP PUMP command requires two keywords and a name that you supply:

DROP PUMP myNextPumpName;

Choices can also appear on the main line.

For example:

alterPump

As this chart shows, only two types of ALTER PUMP commands are valid:

ALTER PUMP myNextPumpName START;

or

ALTER PUMP myNextPumpName STOP;

What Are Optional Paths?

An optional path contains optional elements, such as optional punctuation or optional clauses, also shown in boxes. Three types of optional path can show the following:

1.A simple bypass around an element, avoiding its use
2.Optional elements to be used in addition to the main line elements
3.Optional elements to be used instead of the bypassed element.

Here's an example of the first and second type above:

drop stream

A DROP STREAM command can optionally include either CASCADE or RESTRICTED, but not both:

DROP STREAM myNamedStream. This bypasses the choice of using an additional word from the two allowable possibilities.
DROP STREAM myNamedStream CASCADE
DROP STREAM myNamedStream RESTRICTED

Here's an example of the third type above:

drop function

As this chart shows, a DROP FUNCTION command can optionally include the word SPECIFIC in addition to either CASCADE or RESTRICTED:

DROP FUNCTION myNamedFunction
DROP FUNCTION SPECIFIC myNamedFunction
DROP FUNCTION myNamedFunction CASCADE
DROP FUNCTION myNamedFunction RESTRICTED
DROP FUNCTION SPECIFIC myNamedFunction CASCADE
DROP FUNCTION SPECIFIC myNamedFunction RESTRICTED

Lists

Many charts indicate that a command can include a list of elements, by showing a return arrow leading back in the opposite direction from the main flow, to the starting point of the repeatable item. Usually that return arrow line includes a separator such as a comma. The CREATE VIEW command illustrates such a construction when a user wishes to specify a list of column names:

create_view_02

This chart shows that to list column names in a CREATE VIEW command, you must enclose the list in parentheses and put commas after each name (except the last in the list).

Example:

CREATE VIEW myNewView (order#, item#, price, quantity) AS SELECT * FROM orderStream;

The chart also shows that when additional relevant information doesn't easily fit the chart form, it can be included in a type of footnote.

Multiple Subclauses and Subcharts

Optional paths can illustrate multiple ways to combine or omit optional clauses.

The CREATE PUMP command can have a DESCRIPTION or not, and can include a START or STOP directive with or without a DESCRIPTION:

create_pump_03a

Examples:

CREATE PUMP myNamedPump

           AS INSERT INTO myNamedStream SELECT * FROM InputStream01

CREATE PUMP myNamedPump DESCRIPTION 'Inserts data into stream'

           AS INSERT INTO myNamedStream SELECT FROM InputStream01

CREATE PUMP myNamedPump START

           AS INSERT INTO myNamedStream SELECT * FROM InputStream01

CREATE PUMP myNamedPump STOP

           AS INSERT INTO myNamedStream SELECT * FROM InputStream01

CREATE PUMP myNamedPump START DESCRIPTION 'Inserts data into stream'

           AS INSERT INTO myNamedStream SELECT * FROM InputStream01

This chart also shows that subcharts can be referenced as part of the command, such as the streaming insert. In some cases, these subcharts can require additional subcharts to fully document the alternatives available.

For example, the chart below for CREATE STREAM refers to several subcharts: column_list, sort_clause, and option-specifications.

create_streams_04bfirst

create_streams_04bsecond

This chart also refers back to the column_list subchart of the first CREATE STREAM chart.