[Tutorial] SQL Keywords in Base

Forum rules
No question in this section please
For any question related to a topic, create a new thread in the relevant section.
Post Reply
User avatar
r4zoli
Volunteer
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

[Tutorial] SQL Keywords in Base

Post by r4zoli »

You avoid to use all SQL standard keywords, but you could use them in double quote, details in HSQLDB documentation 2nd Chapter:
SQL Standard Support

HSQLDB 1.8.0 supports the dialect of SQL defined by SQL standards 92, 99 and 2003. This means where a feature of the standard is supported, e.g. left outer join, the syntax is that specified by the standard text. Many features of SQL92 and 99 up to Advanced Level are supported and there is support for most of SQL 2003 Foundation and several optional features of this standard. However, certain features of the Standards are not supported so no claim is made for full support of any level of the standards.

The SQL Syntax chapter of this guide SQL Syntax lists all the keywords and syntax that is supported. When writing or converting existing SQL DDL (Data Definition Language) and DML (Data Manipulation Language) statements for HSQLDB, you should consult the supported syntax and modify the statements accordingly.

Several words are reserved by the standard and cannot be used as table or column names. For example, the word POSITION is reserved as it is a function defined by the Standards with a similar role as String.indexOf() in Java. HSQLDB does not currently prevent you from using a reserved word if it does not support its use or can distinguish it. For example BEGIN is a reserved words that is not currently supported by HSQLDB and is allowed as a table or column name. You should avoid the use of such words as future versions of HSQLDB are likely to support the words and will reject your table definitions or queries. The full list of SQL reserved words is in the source of the org.hsqldb.Token class.

HSQLDB also supports some keywords and expressions that are not part of the SQL standard as enhancements. Expressions such as SELECT TOP 5 FROM .., SELECT LIMIT 0 10 FROM ... or DROP TABLE mytable IF EXISTS are among such constructs.

All keywords, can be used for database objects if they are double quoted.
Download 1.8.x version of HSQLDB, unpack it, you can find reserved words in file ...../hsqldb/src/org/hsqldb/Token.java.

If you want to use keywords, in some reason, you can use them if you add an underscore to the keyword. For example KEY_ .

Not use "Title" as field name, it is bug in OOo 1.8.x which is causing trouble, and not solved until now.

This information valid for all OOo Base version between 2.x and 3.2.x, 3.3, from OOo Base 3.4 HSQLDB 1.9 version will be used.
Last edited by r4zoli on Wed Jul 21, 2010 5:09 pm, edited 2 times in total.
evwool
Volunteer
Posts: 401
Joined: Fri Oct 09, 2009 9:40 pm
Location: UK

Re: [Tutorial] SQL Keywords in Base

Post by evwool »

How do you read the text in the Java file? Can't we just have a text list?
OpenOffice 3.1.1 on Windows XP and on Windows 7 Starter
User avatar
r4zoli
Volunteer
Posts: 2882
Joined: Mon Nov 19, 2007 8:23 pm
Location: Budapest, Hungary

Re: [Tutorial] SQL Keywords in Base

Post by r4zoli »

This is a source file, can be open any text editor.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
Post Reply