ODBC SQL Grammar

Previous Next

This section describes the ODBC SQL grammar used by USoft applications.

· Data Manipulation Language (DML)

SELECT .. FROM .. [WHERE ..] [GROUP BY .. [HAVING ..]]

         [UNION ..] [ORDER BY ..]

SELECT .. FROM .. [WHERE ..] FOR UPDATE OF [columns] (when supported)

INSERT INTO .. [columns] VALUES (..)

INSERT INTO .. [columns] query-specification

UPDATE .. SET column = expr [, column = expr].. [WHERE ..]

DELETE FROM .. [WHERE ..]

· Data Definition Language (DDL)

CREATE TABLE .. ( column-id <data type> [NOT NULL], .. )

DROP   TABLE ..

CREATE [UNIQUE] INDEX .. ON .. ( column-id [ASC | DESC], ... )

DROP   INDEX ..

CREATE VIEW .. [( column-id, ... )] AS query-specification

DROP   VIEW ..

· Data Authorization

GRANT ALL | DELETE | INSERT | SELECT | UPDATE [columns]. ON...TO ..

REVOKE ALL | DELETE | INSERT | SELECT | UPDATE .. ON .. FROM ..

· SQL grammar used when available:

ALTER TABLE .. RENAME TABLE ..

ALTER TABLE .. RENAME ..

RENAME TABLE .. TO ..

RENAME TABLE ..   ..

NOTE:

ODBC has no prescribed syntax for renaming a table. Most RDBMSs however are capable of renaming a table. To make optimal use of the RDBMS capabilities, USoft uses the above ALTER / RENAME TABLE syntax formats when creating application tables and "remembers" which syntax format succeeded, so it will be used from then on. When none of the above syntax's are available, a new (changed) table is created and the old table data inserted, then the old table is dropped.