From a77d9e3a7905a4591548ee21c67669820b6c4c2e Mon Sep 17 00:00:00 2001 From: dimitr Date: Sat, 22 Jan 2005 21:03:03 +0000 Subject: [PATCH] More docs. --- doc/sql.extensions/README.distinct | 27 +++++++++++++ doc/sql.extensions/README.sequence_generators | 40 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 doc/sql.extensions/README.distinct create mode 100644 doc/sql.extensions/README.sequence_generators diff --git a/doc/sql.extensions/README.distinct b/doc/sql.extensions/README.distinct new file mode 100644 index 0000000000..982b9c84e1 --- /dev/null +++ b/doc/sql.extensions/README.distinct @@ -0,0 +1,27 @@ +------------------ +DISTINCT predicate +------------------ + + Function: + Specify a test of whether two row values are distinct. + + Author: + Oleg Loa + Dmitry Yemanov + + Syntax rules: + IS [NOT] DISTINCT FROM + + Scope: + DSQL, PSQL + + Example(s): + 1. SELECT * FROM T1 JOIN T2 ON T1.NAME IS NOT DISTINCT FROM T2.NAME; + 2. SELECT * FROM T WHERE T.MARK IS DISTINCT FROM 'test' + + Note(s): + 1. A DISTINCT predicate evaluates very similar to an equality predicate with + the only difference that two NULL values are considered not distinct. As a result, + this predicate never evaluates to UNKNOWN truth value (the same as IS [NOT] NULL + predicate behaves). + 2. The NOT DISTINCT predicate can be optimized via an index, if exists. diff --git a/doc/sql.extensions/README.sequence_generators b/doc/sql.extensions/README.sequence_generators new file mode 100644 index 0000000000..c3950c8fe4 --- /dev/null +++ b/doc/sql.extensions/README.sequence_generators @@ -0,0 +1,40 @@ +------------------- +Sequence generators +------------------- + + Function: + A sequence generator is a mechanism for generating successive exact + numeric values, one at a time. A sequence generator is a named schema + object. + + Syntax rules: + CREATE { SEQUENCE | GENERATOR } + DROP { SEQUENCE | GENERATOR } + SET GENERATOR TO + ALTER SEQUENCE RESTART WITH + GEN_ID (, ) + NEXT VALUE FOR + + Type: + INTEGER in dialect 1, BIGINT in dialect 3 + + Example(s): + 1. CREATE SEQUENCE S_EMPLOYEE; + 2. ALTER SEQUENCE S_EMPLOYEE RESTART WITH 0; + 3. SELECT GEN_ID(S_EMPLOYEE, 1) FROM RDB$DATABASE; + 4. INSERT INTO EMPLOYEE (ID, NAME) VALUES (NEXT VALUE FOR S_EMPLOYEE, 'John Smith'); + + Note(s): + 1. SEQUENCE is a syntax term declared in the SQL specification, while + GENERATOR is a legacy InterBase syntax term. It's recommended to use + the standard SEQUENCE syntax in your applications. + 2. Currently, increment values not equal to 1 (one) could be used only via + the GEN_ID function. The future versions are expected to provide full + support for SQL-99 sequence generators (which allows the required + increment values to be specified at the DDL level), so it's recommended + to get new sequential values via NEXT VALUE FOR value expression instead + of the GEN_ID function, unless it's vitally important to use other + increment values. + 3. GEN_ID(, 0) allows you to retrieve the current sequence value, + but it should be never used in insert/update statements, as it produces a + high risk of uniqueness violations in a concurrent environment.