如何使用看起来像HSQLDB关键字的列名创建表?

时间:2022-02-17 01:11:53

The following SQL will not accepted by HSQLDB because of the name 'position' is a keyword.

HSQLDB不接受以下SQL,因为名称“position”是关键字。

CREATE MEMORY TABLE bb (position bigint)

创建记忆表bb(位置bigint)

How to create this table without changing the column name?

如何在不更改列名的情况下创建此表?

2 个解决方案

#1


0  

I don't know HSQLDB, but some SQLs let you use special quotes to force them to accept reserved identifiers.

我不知道HSQLDB,但是一些SQL允许你使用特殊引号来强制它们接受保留的标识符。

I'd suggest trying first single quotes, then backticks. If that doesn't work, someone else will hopefully have posted something that does! :)

我建议尝试第一个单引号,然后是反引号。如果这不起作用,其他人肯定会发布一些有用的东西! :)

#2


10  

From the HSQLDB User Guide:

从HSQLDB用户指南:

All keywords, can be used for database objects if they are double quoted.

如果双引号,则所有关键字都可用于数据库对象。

So your statement should simply read:

所以你的陈述应该是:

CREATE MEMORY TABLE bb ("position" bigint)

#1


0  

I don't know HSQLDB, but some SQLs let you use special quotes to force them to accept reserved identifiers.

我不知道HSQLDB,但是一些SQL允许你使用特殊引号来强制它们接受保留的标识符。

I'd suggest trying first single quotes, then backticks. If that doesn't work, someone else will hopefully have posted something that does! :)

我建议尝试第一个单引号,然后是反引号。如果这不起作用,其他人肯定会发布一些有用的东西! :)

#2


10  

From the HSQLDB User Guide:

从HSQLDB用户指南:

All keywords, can be used for database objects if they are double quoted.

如果双引号,则所有关键字都可用于数据库对象。

So your statement should simply read:

所以你的陈述应该是:

CREATE MEMORY TABLE bb ("position" bigint)