Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
37
Добавлен:
18.03.2015
Размер:
2.3 Кб
Скачать

---------------------------------------- Select statements and select expressions ---------------------------------------- Semantics: A select statement is used to return data to the caller (PSQL module or the client program). Select expressions retrieve parts of data that construct both the final the result set or any of the intermediate sets. Select expressions are also known as subqueries. Syntax rules: ::= [FOR UPDATE] [WITH LOCK] ::= [UNION [{ALL | DISTINCT}] ] ::= SELECT [FIRST ] [SKIP ] FROM WHERE GROUP BY HAVING PLAN ORDER BY ROWS [TO ] ::= | | ::= { | } ::= CROSS JOIN ::= [{INNER | {LEFT | RIGHT | FULL} [OUTER]}] JOIN ON ::= '(' ')' Conclusions: * FOR UPDATE mode and row locking can only be performed for a final dataset, they cannot be applied to a subquery * Unions are allowed inside any subquery * Clauses FIRST, SKIP, PLAN, ORDER BY, ROWS are allowed for any subquery Notes: * Either FIRST/SKIP or ROWS is allowed, they cannot be mixed together (a syntax error is thrown). * INSERT statement accepts a select expression to create a dataset to be inserted into a table. So its SELECT part supports all the features defined above. * UPDATE and DELETE statements are always based on an implicit cursor iterating through its target table and limited with the WHERE clause. You may also specify the final parts of the select expression syntax to limit the number of affected rows or optimize the statement. The following clauses are allowed at the end of the UPDATE/DELETE statements: PLAN, ORDER BY and ROWS.

Соседние файлы в папке sql.extensions