Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Query expression

In SESAM/SQL, query expressions are the most important means of querying data.

This chapter describes the syntax of query expressions and provides you with an explanation of the various joins. It is subdivided into the following sections:

  • Table specifications

  • SELECT expression

  • Table queries

  • Joins

  • Subquery

  • Combining query expressions with UNION

  • Combining query expressions with EXCEPT DISTINCT

  • Updatability of query expressions

Overview

You use query expressions to select rows and columns from base tables and views. The rows found constitute the derived table.

A query expression is part of an SQL statement. A query expression can occur in subqueries or in any of the following SQL statements:


CREATE VIEW

DECLARE CURSOR

INSERT

Define a view

Declare a cursor

Insert rows in table

The examples in this chapter only show the relevant query expression. Without the associated subquery or SQL statement, the examples are of course not executable.

If you want to use a subquery in an SQL statement, you must own the table referenced in the subquery or have SELECT privilege for the table involved.


query_expression ::= [ query_expression { UNION [ALL | DISTINCT] | EXCEPT [DISTINCT] }]

                   { select_expression | TABLE table | join_expression | ( query_expression ) }



select_expression

SELECT expression (see section "SELECT expression")

TABLE table

Table query, see section "TABLE - Table query".

join_expression

Join expression (see section "Join expression")

(query_expression)

Subquery, see section "Subquery".

UNION

Combine two query expressions with UNION, see section "Combining query expressions with UNION".

EXCEPT DISTINCT

Combine two query expressions with EXCEPT, see section "Combining query expressions with EXCEPT".