Quoting

GDBase keywords

The SQL standard specifies a huge number of keywords which may not be used as the names of tables, indices, columns, or databases. The list is so long that few people can remember them all. For most SQL code, your safest assumption is to never use any English language words as the names of user-defined objects.

If you want to use a keyword as a name, you need to quote it. There are three ways of quoting keywords in GDBase:

'keyword'
A keyword in single quotes is interpreted as a literal string if it occurs in a context where a string literal is allowed, otherwise it is understood as an identifier.
"keyword"
A keyword in double-quotes is interpreted as an identifier if it matches a known identifier.
[keyword]
A keyword enclosed in square brackets is always understood as an identifier. This is not standard SQL. This quoting mechanism is used by MS Access and SQL Server and is included in GDBase for compatibility.

New keywords may be added to GDBase from time to time, as new features are implemented. To prevent your code from being broken by future enhancements, you should normally quote any indentifier that is an English language word, even if it is not a restricted keyword in the version of GDBase at a given time.

For the list of keywords recognized by GDBase see the Keywords appendix.

Special characters

To use a name which contains some special character (e.g. table name with space character) the user may choose one of the several ways to avoid problems:

Example 43.40. Use single quotes or brackets

SELECT * FROM `TAB 1` 
SELECT * FROM 'TAB 1' 
SELECT * FROM [TAB 1]
                

Example 43.41.  Use the repr function

tableName = repr('TAB 1') 
SELECT * from $tableName
                

Example 43.42. Use multi quotes

tableName = '`TAB 1`' 
SELECT * from $tableName
                

Example 43.43. Another usage of quotes

tableName = 'TAB 1' 
SELECT * from '$tableName'
                

Regardless of these examples it is much better to avoid special characters in names.

Note

The use of double quotes (for instance "abc") is not supported except for column names.