Valid characters in names

Keyspace and table names must begin with a letter, and they can contain letters, numbers, and underscores.

All other element names, such as columns and types, can contain any characters. However, if a name contains a special character, such as a period or hyphen, then you must enclose the name in double quotes.

Here are some examples of valid and invalid statements with special characters. These statements are truncated to focus on the use of special characters and double quotes.

// Valid statements
CREATE TABLE foo ...
CREATE TABLE foo_bar ...
CREATE TABLE foo ("what#*&" text, ...)
ALTER TABLE foo5 ...
CREATE FUNCTION "foo5$$${caret}%" ...
CREATE AGGREGATE "foo5!@#" ...
CREATE TYPE foo5 ("bar#9" text, ...)

// Invalid statements

// Table names can only include letters, numbers, and underscores
CREATE TABLE foo!$% ...
CREATE TABLE foo[]"90 ...
ALTER TABLE "foo5$$"...

// Element names with special characters must be enclosed in double quotes
CREATE TABLE foo (what#*& text, ...)
CREATE FUNCTION foo5$$...
CREATE AGGREGATE foo5$$
CREATE TYPE foo5 (bar#9 text, ...)

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2025 DataStax | Privacy policy | Terms of use | Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com