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

SQL Language Enhancements

i)

SELECT * FROM MSG

ORDER BY PROCESS_TIME DESC NULLS FIRST

ii)

SELECT FIRST 10 * FROM DOCUMENT

ORDER BY STRLEN(DESCRIPTION) DESC

iii)

SELECT DOC_NUMBER, DOC_DATE FROM PAYORDER

UNION ALL

SELECT DOC_NUMBER, DOC_DATA FROM BUDGORDER

ORDER BY 2 DESC NULLS LAST, 1 ASC NULLS FIRST

(1.5) SELECT FIRST 0.. is Now Valid

In Firebird 1.5, zero can be accepted as an argument for FIRST in the SELECT FIRST m .. SKIP n construction. An empty result set will be returned.

(1.0) SELECT FIRST m .. SKIP n

(from the v.1.0 release notes)

Syntax Pattern

SELECT [FIRST (<integer expr m>)] [SKIP (<integer expr n>)]

Retrieves the first m rows of the selected output set. The optional SKIP clause will cause the first n rows to be discarded and return an output set of m rows starting at n + 1. In the simplest form, m and n are integers but any Firebird expression that evaluates to an integer is valid.

Available in SQL and DSQL except where otherwise indicated.

Arguments m and n

Parentheses are required for expression arguments and are optional otherwise.

The arguments can also bind variables, e.g.

SKIP ? * FROM ATABLE returns the remaining dataset after discarding the n rows at the top, where n is passed in the "?" variable.

SELECT FIRST ? COLUMNA, COLUMNB FROM ATABLE returns the first m rows and discards the rest.

An identifier that evaluates to an integer may also be used in GDML, although not in SQL or DSQL.

37

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Оставленные комментарии видны всем.

Соседние файлы в папке doc