gpt4 book ai didi

sql - 关闭 HSQL 中表名和列名的大写?

转载 作者:行者123 更新时间:2023-12-04 10:48:20 24 4
gpt4 key购买 nike

如何关闭 HSQL 中表名和列名的强制大写模式?

<artifactId>hsqldb</artifactId>
<version>2.3.1</version>

操作系统: Windows 7 x64

最佳答案

HSQLDB documentation 中解释了有关此问题的规则。 :

When a database object is created with one of the CREATE statements or renamed with the ALTER statement, if the name is enclosed in double quotes, the exact name is used as the case-normal form. But if it is not enclosed in double quotes, the name is converted to uppercase and this uppercase version is stored in the database as the case-normal form.



Case sensitivity rules for identifiers can be described simply as follows:

  • all parts of SQL statements are converted to upper case before processing, except identifiers in double quotes and strings in single quotes
  • identifiers, both unquoted and double quoted, are then treated as case-sensitive
  • most database engines follow the same rule, except, in some respects, MySQL and MS SQLServer.


AFAIK 无法关闭此行为。 (值得注意的是,当不使用带引号的标识符时,标准 SQL 不区分大小写。)但如上所述,可以通过用引号括起来来指定小写标识符,例如:
CREATE TABLE "lowercasetablename" ("lowercasecolname" INT);
SELECT "lowercasecolname" FROM "lowercasetablename";

关于sql - 关闭 HSQL 中表名和列名的大写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36196630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com