Uppercase and lowercase
Identifiers created using CQL are case-insensitive unless enclosed in double quotation marks. If you enter names for these objects using any uppercase letters, the database stores the names in lowercase. You can force the case using double quotation marks. For example:
CREATE TABLE cycling.uppercase (
Foo int PRIMARY KEY,
"Bar" int
);
The following table shows partial queries that work and do not work to return results from the test table:
Queries that Work | Queries that Don’t Work |
---|---|
SELECT foo FROM . . . |
SELECT "Foo" FROM . . . |
SELECT Foo FROM . . . |
SELECT "BAR" FROM . . . |
SELECT FOO FROM . . . |
SELECT bar FROM . . . |
SELECT "Bar" FROM . . . |
SELECT Bar FROM . . . |
SELECT "foo" FROM . . . |
SELECT "bar" FROM . . . |
SELECT "foo" FROM ...
works because the database stores foo in lowercase.
When using legacy tables, case-sensitivity rules in earlier versions of CQL apply.
CQL keywords are case-insensitive.
For example, SELECT
and select
are equivalent.
This document shows keywords in uppercase.
To escape characters, see Escaping characters.