AbsDB SQL Naming conventions
|
<< Click to Display Table of Contents >> AbsDB SQL Naming conventions |
![]() ![]()
|
Naming Conventions
Absolute Database requires to apply the following rules and naming conventions to all SQL statements.
Table Names
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"
Column Names
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
Correlation Names
To simplify SQL statement table and column correlation names are often used (AS keyword is optional):
SELECT E.EmpNo AS No FROM Employee AS E
where "No" is a correlation name (alias) for E.EmpNo field name and "E" is a correlation name (alias) for the Employee table name.
Constants
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')
Comments
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 temporarily exclude some parts of the SQL statement.
SELECT * FROM Employee
/* WHERE EmpNo < 5
ORDER BY EmpNo */
_____________________________
27-10-2017 - Niels Knabe