Derby Database Table Column Name Format Inconsistent in Query

后端 未结 1 1530
独厮守ぢ
独厮守ぢ 2021-01-21 13:22

When query a Derby database, I find out that for some tables I have to double quote the column name and use table name to qualify the column name, but for some other tables I d

1条回答
  •  囚心锁ツ
    2021-01-21 13:37

    Putting a tablename or column name in quotes, sometimes referred to by the jargon-y term "delimited identifiers" does two things:

    1. Allows you to use words that are otherwise reserved keywords (e.g., naming a column "WHERE" or "SELECT")
    2. Instructs the database system to process the name using case sensitive rules, rather than case-insensitive rules

    So if you originally created "table3" with a CREATE TABLE statement that specified "table3" in double quotes like this, then you will forever after have to refer to it with the name in double quotes.

    select * from table3

    will be automatically processed by the database as if it was

    select * from TABLE3

    while

    select * from "table3"

    will successfully match the table you created as create table "table3"

    See: http://db.apache.org/derby/docs/10.9/ref/crefsqlj34834.html

    0 讨论(0)
提交回复
热议问题