Keywords

Reserved keywords have specific meaning in CQL. To use a reserved keyword as an identifier for a keyspace, table, column, function, or user-defined type name, enclose it in double quotes.

Non-reserved keywords are keywords that behave like a reserved keyword, but only in a specific place in a command. Non-reserved keywords can be used as an identifier outside this context without double quotes. However, the database automatically encloses the keyword in double quotes, so any additional actions must include double quotes to reference the object.

CQL Basic Reserved keywords

To use reserved keywords as an identifier in CQL, enclose in double quotes. For example:

#!/bin/bash

tags=("table-create" "table-describe-base" "table-drop")
source variable-config.sh
results_table="$results_dir/table-mixed-case.results"

# PURPOSE: Create a table with mixed case

# $cqlsh -e "SOURCE 'keyspace-cycling.cql[tag=keyspace-create-simple]';"
sed -n '/\/\/ tag::keyspace-create-simple\[\]/,/\/\/ end::keyspace-create-simple\[\]/p' keyspace-cycling.cql | $cqlsh
echo "Executed keyspace creation section."

# $cqlsh -e "SOURCE 'keyspace-cycling.cql[tag=keyspace-use]';"
sed -n '/\/\/ tag::keyspace-use\[\]/,/\/\/ end::keyspace-use\[\]/p' keyspace-cycling.cql | $cqlsh
echo "Executed keyspace use."
echo "Writing results to $results_table"

tag="table-drop[]"
echo -e "\n// tag::$tag" >> $results_table
$cqlsh -e "
// tag::table-drop[]
DROP TABLE IF EXISTS cycling."addThis";
// end::table-drop[]
" >> $results_table
echo "// end::$tag" >> $results_table
echo "Drop table addThis."

tag="table-create[]"
echo -e "// tag::$tag" >> $results_table
$cqlsh -e "
// tag::table-create[]
CREATE TABLE cycling."addThis" (
  a int PRIMARY KEY
);
// end::table-create[]
" >> $results_table
echo "// end::$tag" >> $results_table
echo "Created table"

tag="table-describe-base[]"
echo -e "\n// tag::$tag" >> $results_table
$cqlsh -e "
// tag::table-describe-base[]
DESCRIBE TABLE cycling."addThis";  
// end::table-describe-base[]
" >> $results_table
echo "// end::$tag" >> $results_table
echo "Describe table addThis"

Reserved keyword list:

  • ADD

  • ALLOW

  • ALTER

  • AND

  • APPLY

  • ASC

  • AUTHORIZE

  • BATCH

  • BEGIN

  • BY

  • COLUMNFAMILY

  • CREATE

  • DEFAULT

  • DELETE

  • DESC

  • DESCRIBE

  • DROP

  • ENTRIES

  • EXECUTE

  • FOR

  • FROM

  • FULL

  • GRANT

  • IF

  • IN

  • INDEX

  • INFINITY

  • INSERT

  • INTO

  • IS

  • KEYSPACES

  • LIMIT

  • MATERIALIZED

  • MBEAN

  • MBEANS

  • MODIFY

  • NAN

  • NORECURSIVE

  • NOT

  • NULL

  • OF

  • ON

  • OR

  • ORDER

  • PRIMARY

  • RENAME

  • REPLACE

  • REVOKE

  • SCHEMA

  • SELECT

  • SET

  • TABLE

  • TO

  • TOKEN

  • TRUNCATE

  • UNLOGGED

  • UNSET

  • UPDATE

  • USE

  • USING

  • VIEW

  • WHERE

  • WITH

CQL Basic Non-reserved keywords

Non-reserved keywords can be used as an identifier without double quotes outside the specific place that the keyword has meaning in a command.

Non-reserved keyword list:

  • AGGREGATE

  • ALL

  • AS

  • CALLED

  • CAST

  • CLUSTERING

  • COMPACT

  • CONTAINS

  • COUNT

  • CUSTOM

  • DISTINCT

  • EXISTS

  • FILTERING

  • FINALFUNC

  • FROZEN

  • FUNCTION

  • FUNCTIONS

  • GROUP

  • INITCOND

  • INPUT

  • JSON

  • KEY

  • KEYS

  • KEYSPACE

  • LANGUAGE

  • LIKE

  • LIST

  • LOGIN

  • MAP

  • NOLOGIN

  • NOSUPERUSER

  • OPTIONS

  • PARTITION

  • PASSWORD

  • PER

  • PERMISSION

  • PERMISSIONS

  • RESTRICT

  • RETURNS

  • ROLE

  • ROLES

  • SFUNC

  • STATIC

  • STORAGE

  • STYPE

  • SUPERUSER

  • TRIGGER

  • TTL

  • TYPE

  • USER

  • USERS

  • VALUES

  • WRITETIME

All CQL data types are also non-reserved keywords:

  • ASCII

  • BIGINT

  • BLOB

  • BOOLEAN

  • COUNTER

  • DATE

  • DECIMAL

  • DOUBLE

  • DURATION

  • FLOAT

  • INET

  • INT

  • SMALLINT

  • TEXT

  • TIME

  • TIMESTAMP

  • TIMEUUID

  • TINYINT

  • TUPLE

  • UNRESTRICT

  • UUID

  • VARCHAR

  • VARINT

DSE Non-reserved keywords

There are additional non-reserved keywords can be used as an identifier without double quotes in CQL that are DSE-specific.

DSE

Non-reserved keyword list:
  • ACTIVE

  • ANY

  • APPLICATION

  • APPLICATIONS

  • AUTHENTICATION

  • BACKUPS

  • CALL

  • CALLS

  • CANCEL

  • CLEAN

  • COLUMNS

  • COMMIT

  • CONFIG

  • CONFIGURATION

  • CONFIGURATIONS

  • CLUSTER

  • DEFAULT

  • DELEGATION

  • DESTINATION

  • DESTINATIONS

  • DETERMINISTIC

  • DROPPED

  • EDGE

  • EXECUTOR

  • EXECUTORS

  • FIELD

  • HASHED

  • INDICES

  • INTERNAL

  • JAVA

  • KERBEROS

  • LDAP

  • LABEL

  • LOWERCASESTRING

  • METHOD

  • MONOTONIC

  • NO

  • NODE

  • NODES

  • OBJECT

  • PLAN

  • PROFILES

  • REBUILD

  • RECORD

  • REDACT

  • RELOAD

  • REMOTE

  • RENEW

  • RESOURCE

  • RESTORE

  • RESTRICT

  • ROWS

  • RUN

  • SCHEMA

  • SCHEME

  • SCHEMES

  • SEARCH

  • STDERR

  • STDOUT

  • STORE

  • SUBMISSION

  • TARGET

  • TOKEN

  • UNRESTRICT

  • UNSET

  • VERIFY

  • VERTEX

  • WITHOUT

  • WORKPOOL

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

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