Contents
This is a summary reference of the subset of SQL which is understood by DBMS in EPOC Release 5. The syntax is, in general, standard and, where there are deviations, these are noted.
The grammar notation is similar to that used in the pre-ER5 documentation.
Section Contents
- select-statement :
SELECT select-list
FROM table-name
[ WHERE search-condition ]
[ ORDER BY sort-specification-comma-list ]
- create-table-statement :
CREATE TABLE table-name (column-definition-comma-list)
- drop-table-statement :
DROP TABLE table-name
- alter-table-statement :
ALTER TABLE table-name
{
ADD add-column-set [ DROP drop-column-set ]
| DROP drop-column-set
}
- create-index-statement :
CREATE [ UNIQUE ] INDEX index-name ON table-name
( sort-specification-comma-list )
- drop-index-statement :
DROP INDEX index-name FROM table-name
- insert-statement :
INSERT INTO table-name [ ( column-identifier-comma-list ) ]
VALUES ( column-value-comma-list )
- delete-statement :
DELETE FROM table-name [ WHERE search-condition ]
- update-statement :
UPDATE table-name SET update-column-comma-list
[ WHERE search-condition ]
- add-column-set :
add-column-spec | ( add-column-spec-comma-list )
- add-column-spec :
column-identifier data-type
- boolean-factor :
[ NOT boolean-primary ]
- boolean-primary :
predicate | ( search-condition )
- boolean-term :
boolean-factor [ AND boolean-term ]
- column-definition :
column-identifier data-type [ NOT NULL ]
- column-identifier :
user-defined-name
- column-value :
literal | NULL
- comparison-operator :
< | > | <= | >= | = | <>
- comparison-predicate :
column-identifier comparison-operator literal
- data-type :
BIT
| [ UNSIGNED ] TINYINT
| [ UNSIGNED ] SMALLINT
| [ UNSIGNED ] INTEGER
| COUNTER
| BIGINT
| REAL
| FLOAT | DOUBLE [ PRECISION ]
| DATE | TIME | TIMESTAMP
| CHAR [ (n) ] | VARCHAR [ (n) ]
| LONG VARCHAR
| BINARY [ (n) ] | VARBINARY [ (n) ]
| LONG VARBINARY
- date-literal :
#{exact date expression}#
Valid date and time expressions are those which can be parsed by the Parse() member function of the TTime class.
- digit :
0 | 1 | 2 | ... 8 | 9
- drop-column-set :
column-identifier | ( column-identifier-comma-list )
- index-name :
user-defined-name
- letter :
a | b ... y | z | A | B ... Y | Z
- like-predicate :
column-identifier [ NOT ] LIKE pattern-value
- literal :
string-literal | numeric-literal | date-literal
- null-predicate :
column-identifier IS [ NOT ] NULL
- numeric-literal :
{exact numeric types}
Valid numeric forms are those which can be parsed by the Val(TInt64&) and Val(TReal&) member functions of the TLex class.
- pattern-value :
string-literal
Non SQL-standard characters in the pattern value are used as wildcards:
- question mark (?) represents any single character
- asterisk (*) represents zero or more characters
Standard SQL uses the underscore (_) and percent (%) characters respectively.
- predicate :
comparison-predicate | like-predicate | null-predicate
- search-condition :
boolean-term [ OR search-condition ]
- select-list :
* | column-identifier-comma-list
- sort-specification :
column-identifier [ ASC | DESC ]
- string-literal :
'{character}'
Character strings can contain any text character. A single quote character (') can be embedded by using two single quote characters.
- table-name :
user-defined-name
- update-column :
column-identifier = column-value
- user-defined-name :
letter [ letter | digit | _ ]...
SQL type
|
DBMS type
|
BIT
|
EDbColBit
|
TINYINT
|
EDbColInt8
|
UNSIGNED TINYINT
|
EDbColUint8
|
SMALLINT
|
EDbColInt16
|
UNSIGNED SMALLINT
|
EDbColUint16
|
INTEGER
|
EDbColInt32
|
UNSIGNED INTEGER
|
EDbColUint32
|
COUNTER
|
EDbColUint32, with the TDbCol::EAutoIncrement attribute
|
BIGINT
|
EDbColInt64
|
REAL
|
EDbColReal32
|
FLOAT DOUBLE DOUBLE PRECISION
|
EDbColReal64
|
DATE TIME TIMESTAMP
|
EDbColDateTime
|
CHAR(n) VARCHAR(n)
|
EDbColText, where n specifies a maximum column length
|
LONG VARCHAR
|
EDbColLongText
|
BINARY(n) VARBINARY(n)
|
EDbColBinary, where n specifies a maximum column length
|
LONG VARBINARY
|
EDbColLongBinary
|
DECIMAL(p,s) NUMERIC(p,s)
|
Not supported
|