Query language elements
Many of the familiar building blocks of SQL queries are also provided by SAQL. A few of the most common and fundamental elements are:
- SELECT, for projecting columns in the query output
- FROM, for setting the input or input-derived data source
- CASE, for condition evaluation
- WHERE, for filtering input data
Certain other SAQL elements, while familiar from traditional database query patterns, have distinctive benefits for streaming data. Let's take a closer look at a few of them:
- WITH: Defines a temporary derived table for later reference in the query. That much is the well-known role that WITH plays in SQL, but in Stream Analytics, it also helps when scaling out a query for more efficient handling of a higher throughput workload. Because the result set defined by
WITH
can be referenced multiple times in the query, encapsulating common business logic there can yield significant savings in the resources used by the Stream Analytics job.
Syntax: WITH result set alias1 AS (SELECT...