<< Click to Display Table of Contents >> Naming Conventions |
Absolute Database requires to apply the following rules and naming conventions to all SQL statements.
Absolute DB supports specifying a database file name in SQL statement. The main reason for specifying a database file name in a query is a selecting table records from multiple databases by a single query.
In all other cases you don't need to specify database file name within a SQL statement.
The database file name must be enclosed in double quotes (""):
SELECT * FROM "c:\data\parts_db.abs".parts, "c:\data\orders_db.abs".orders
Absolute DB supports not only ANSI SQL identifiers, but it is advanced to support multi-word and national table names. A reserved word could also be used as a table name. In such specific cases the table name must be enclosed in single quotes, double quotes, or square brackets.
The following example illustrates using of standard identifier as a table name:
SELECT * FROM Employee
The next statement shows how to use multi-word table name:
SELECT * FROM "Our Employees"
Absolute DB supports not only ANSI SQL identifiers, but it is advanced to support multi-word and national column names. A reserved word could also be used as a column name. In such specific cases the column name must be enclosed in square brackets:
SELECT [First Name] FROM Students
To simplify SQL statement table and column correlation names are often used (AS keyword is optional):
SELECT E.EmpNo AS Nr FROM Employee E
or
SELECT E.EmpNo AS "No" FROM Employee E
"No" with double quotes as No is an SQL reserved word.
Absolute DB supports string, number, boolean, currency, date, and time constants.
The string, date and time constants must be enclosed in single or double quotes.
To insert a single quote into a column, use two consecutive single quotation marks.
For example, to insert the characters "a'b" into col1, use:
INSERT INTO Orders (col1) VALUES('a''b')
Absolute Database supports single-line and multi-line comments which you can use to embed some remarks into SQL statement.
Single-line comment must contain '--' characters at the beginning of the comment line:
-- This query uses emp_db.abs database
SELECT * FROM Employee
Multi-line comment must be enclosed in /* and */ characters.
The following example uses multi-line comment to exclude temporarily some parts of the SQL statement.
SELECT * FROM Employee
/* WHERE EmpNo < 5
ORDER BY EmpNo */
__________________________