blob: 179b159d4512603792ff214f1da9f8941787ed72 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Cassandra Query Language (CQL) v3.4.3 | Apache Cassandra Documentation</title>
<link rel="stylesheet" href="../../../../../assets/css/site.css">
<link rel="schema.dcterms" href="https://purl.org/dc/terms/">
<meta name="dcterms.subject" content="Cassandra">
<meta name="dcterms.identifier" content="5.0">
<meta name="generator" content="Antora 2.3.4">
<link rel="icon" href="../../../../../assets/img/favicon.ico" type="image/x-icon">
<script>
const script = document.createElement("script");
const domain = window.location.hostname;
script.type = "text/javascript";
script.src = "https://plausible.cassandra.apache.org/js/plausible.js";
script.setAttribute("data-domain",domain);
script.setAttribute("defer",'true');
script.setAttribute("async",'true');
document.getElementsByTagName("head")[0].appendChild(script);
</script> </head>
<body class="docs-wrapper article">
<div class="container mx-auto relative">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<meta property="og:type" content="website" />
<meta property="og:url" content="/" />
<meta property="og:site_name" content="Apache Cassandra" />
<header id="top-nav">
<div class="inner relative">
<div class="header-social-icons text-right">
<a href="https://twitter.com/cassandra?lang=en" target="_blank" styles="margin-left: 20px;"><img src="../../../../../assets/img/twitter-icon-circle-white.svg" alt="twitter icon" width="24"></a>
<a href="https://www.linkedin.com/company/apache-cassandra/" target="_blank" styles="margin-left: 20px;"><img src="../../../../../assets/img/LI-In-Bug.png" alt="linked-in icon" width="24"></a>
<a href="https://www.youtube.com/c/PlanetCassandra" target="_blank" styles="margin-left: 20px;"><img src="../../../../../assets/img/youtube-icon.png" alt="youtube icon" width="24"></a>
</div>
<div class="cf">
<div class="logo left"><a href="/"><img src="../../../../../assets/img/logo-white-r.png" alt="Cassandra Logo"></a></div>
<div class="mobile-nav-icon right">
<img class="toggle-icon" src="../../../../../assets/img/hamburger-nav.svg">
</div>
<ul class="main-nav nav-links right flex flex-vert-center flex-space-between">
<li>
<a class="nav-link hide-mobile">Get Started</a>
<ul class="sub-menu bg-white">
<li class="pa-micro">
<a href="/_/cassandra-basics.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-basics.png" alt="cassandra basics icon">
</div>
<div class="sub-nav-text teal py-small">
Cassandra Basics
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/quickstart.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-rocket.png" alt="cassandra basics icon">
</div>
<div class="sub-nav-text teal py-small">
Quickstart
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/ecosystem.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-ecosystem.png" alt="cassandra basics icon">
</div>
<div class="sub-nav-text teal py-small">
Ecosystem
</div>
</a>
</li>
</ul>
</li>
<li><a class="nav-link" href="/doc/latest/">Documentation</a></li>
<li>
<a class="nav-link" href="/_/community.html">Community</a>
<ul class="sub-menu bg-white">
<li class="pa-micro">
<a href="/_/community.html#code-of-conduct">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-welcome.png" alt="welcome icon">
</div>
<div class="sub-nav-text teal py-small">
Welcome
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#discussions">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-discussions.png" alt="discussions icon">
</div>
<div class="sub-nav-text teal py-small">
Discussions
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#project-governance">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-governance.png" alt="Governance icon">
</div>
<div class="sub-nav-text teal py-small">
Governance
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#how-to-contribute">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-contribute.png" alt="Contribute icon">
</div>
<div class="sub-nav-text teal py-small">
Contribute
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/community.html#meet-the-community">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-community.png" alt="Meet the Community icon">
</div>
<div class="sub-nav-text teal py-small">
Meet the Community
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/cassandra-catalyst-program.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-catalyst.png" alt="Catalyst icon">
</div>
<div class="sub-nav-text teal py-small">
Catalyst Program
</div>
</a>
</li>
<li class="pa-micro hide-mobile">
<a href="/_/events.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-events.png" alt="Events icon">
</div>
<div class="sub-nav-text teal py-small">
Events
</div>
</a>
</li>
</ul>
</li>
<li>
<a class="nav-link hide-mobile">Learn</a>
<ul class="sub-menu bg-white">
<li class="pa-micro">
<a href="/_/Apache-Cassandra-5.0-Moving-Toward-an-AI-Driven-Future.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-basics.png" alt="Basics icon">
</div>
<div class="sub-nav-text teal py-small">
Cassandra 5.0
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/case-studies.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-case-study.png" alt="Case Studies icon">
</div>
<div class="sub-nav-text teal py-small">
Case Studies
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/resources.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-resources.png" alt="Resources icon">
</div>
<div class="sub-nav-text teal py-small">
Resources
</div>
</a>
</li>
<li class="pa-micro">
<a href="/_/blog.html">
<div class="sub-nav-icon">
<img src="../../../../../assets/img/sub-menu-blog.png" alt="Blog icon">
</div>
<div class="sub-nav-text teal py-small">
Blog
</div>
</a>
</li>
</ul>
</li>
<li><a class="nav-link btn btn--filled" href="/_/download.html">Download Now</a></li>
</ul>
</div>
</div>
</header>
<div class="hero hero--home grad">
<div class="eye"></div>
<div id="docs-content" class="text-center flex flex-center flex-column relative z2 ma-xlarge">
<h2>Cassandra Documentation</h2>
</div>
</div>
<div class="body px-medium py-medium container">
<div class="docs-nav-bar flex flex-space-between mb-medium">
<div id="mobile-docs-nav-burger" class="hidden">
<svg viewBox="0 0 24 24" width="36" height="36" stroke="#1c81a0" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
</div>
<div class="docs-nav-item relative">
<input id="search-input" type="text" placeholder="Search docs">
</div>
<div class="versions-wrapper">
<h4>Version:</h4>
<div class="nav-panel-explore" data-panel="explore">
<div id="version-toggle" class="context">
<span class="version">5.0</span>
</div>
<ul id="versions-list" class="components">
<li class="component">
<ul class="versions">
<li class="version is-latest">
<a href="../../../../../_/index.html">master</a>
</li>
</ul>
</li>
<li class="component is-current">
<ul class="versions">
<li class="version">
<a href="../../../../trunk/index.html">trunk</a>
</li>
<li class="version is-current">
<a href="../../../index.html">5.0</a>
</li>
<li class="version is-latest">
<a href="../../../../4.1/index.html">4.1</a>
</li>
<li class="version">
<a href="../../../../4.0/index.html">4.0</a>
</li>
<li class="version">
<a href="../../../../3.11/index.html">3.11</a>
</li>
</ul>
</li>
</ul>
</div>
</div> </div>
<div class="cf relative">
<nav class="nav docs-nav full-800">
<div class="nav-menu">
<ul class="nav-list">
<li class="nav-item is-active" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../index.html">Main</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/glossary.html">Glossary</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/bugs.html">How to report bugs</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/contactus.html">Contact us</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../../../../_/development/index.html">Development</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/gettingstarted.html">Getting started</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/ide.html">Building and IDE integration</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/testing.html">Testing</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/patches.html">Contributing code changes</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/code_style.html">Code style</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/how_to_review.html">Review checklist</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/how_to_commit.html">How to commit</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/documentation.html">Working on documentation</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/ci.html">Jenkins CI environment</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/dependencies.html">Dependency management</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../../../../_/development/release_process.html">Release process</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item is-active" data-depth="0">
<ul class="nav-list">
<li class="nav-item is-current-path is-active" data-depth="1">
<span class="nav-line">
<button class="nav-toggle"></button>
<span class="nav-text">Cassandra</span>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../overview/faq/index.html">FAQ</a>
</span>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../getting-started/index.html">Getting Started</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/cassandra-quickstart.html">Cassandra Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/sai-quickstart.html">SAI Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/vector-search-quickstart.html">Vector Search Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../installing/installing.html">Installing Cassandra</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/configuring.html">Configuring Cassandra</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/querying.html">Inserting and querying</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/drivers.html">Client drivers</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/production.html">Production recommendations</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../new/index.html">What&#8217;s new</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/java17.html">Support for Java</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../architecture/index.html">Architecture</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../architecture/overview.html">Overview</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../architecture/dynamo.html">Dynamo</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../architecture/storage-engine.html">Storage Engine</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../architecture/guarantees.html">Guarantees</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../architecture/messaging.html">Improved Internode Messaging</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../architecture/streaming.html">Improved Streaming</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../data-modeling/index.html">Data Modeling</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/intro.html">Introduction</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_conceptual.html">Conceptual data modeling</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_rdbms.html">RDBMS design</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_queries.html">Defining application queries</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_logical.html">Logical data modeling</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_physical.html">Physical data modeling</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_refining.html">Evaluating and refining data models</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_schema.html">Defining database schema</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../data-modeling/data-modeling_tools.html">Cassandra data modeling tools</a>
</span>
</li>
</ul>
</li>
<li class="nav-item is-current-path is-active" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="index.html">Cassandra Query Language (CQL)</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="definitions.html">Definitions</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="types.html">Data types</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="ddl.html">Data definition (DDL)</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="dml.html">Data manipulation (DML)</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="dynamic-data-masking.html">Dynamic Data Masking (DDM)</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="operators.html">Operators</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="indexing/indexing-concepts.html">Indexing concepts</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="indexing/sai/sai-overview.html">SAI Overview</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/sai/sai-concepts.html">Concepts</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/sai-quickstart.html">SAI Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/sai/sai-faq.html">SAI FAQ</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/sai/sai-working-with.html">Working with SAI</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/sai/operations/sai-operations.html">SAI operations</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="indexing/2i/2i-overview.html">Secondary indexes (2i) overview</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/2i/2i-concepts.html">Concepts</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/2i/2i-working-with.html">Working with 2i</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="indexing/2i/operations/2i-build.html">Rebuild 2i</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="mvs.html">Materialized views</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="functions.html">Functions</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="json.html">JSON</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="security.html">Security</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="triggers.html">Triggers</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="appendices.html">Appendices</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="changes.html">Changes</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="SASI.html">SASI</a>
</span>
</li>
<li class="nav-item is-current-page is-active" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="cql_singlefile.html">Single file of CQL information</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../vector-search/overview.html">Vector Search overview</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../vector-search/concepts.html">Concepts</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../vector-search/data-modeling.html">Data Modeling</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../getting-started/vector-search-quickstart.html">Vector Search Quickstart</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../vector-search/vector-search-working-with.html">Working with Vector Search</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../managing/index.html">Managing</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../managing/configuration/index.html">Configuring</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_yaml_file.html">cassandra.yaml</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_rackdc_file.html">cassandra-rackdc.properties</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_env_sh_file.html">cassandra-env.sh</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_topo_file.html">cassandra-topologies.properties</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_cl_archive_file.html">commitlog-archiving.properties</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_logback_xml_file.html">logback.xml</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/cass_jvm_options_file.html">jvm-* files</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/configuration/configuration.html">Liberating cassandra.yaml Parameters' Names from Their Units</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../managing/operating/index.html">Operating</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/backups.html">Backups</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/bloom_filters.html">Bloom filters</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/bulk_loading.html">Bulk loading</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/cdc.html">Change Data Capture (CDC)</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/compaction/index.html">Compaction</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/compression.html">Compression</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/hardware.html">Hardware</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/hints.html">Hints</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../managing/operating/logging.html">Logging</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/auditlogging.html">Audit logging</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/audit_logging.html">Audit logging 2</a>
</span>
</li>
<li class="nav-item" data-depth="5">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/fqllogging.html">Full query logging</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/metrics.html">Monitoring metrics</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/repair.html">Repair</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/read_repair.html">Read repair</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/security.html">Security</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/snitch.html">Snitches</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/topo_changes.html">Topology changes</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/transientreplication.html">Transient replication</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/operating/virtualtables.html">Virtual tables</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../managing/tools/index.html">Tools</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/tools/cqlsh.html">cqlsh: the CQL shell</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/tools/nodetool/nodetool.html">nodetool</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="../../managing/tools/sstable/index.html">SSTable tools</a>
</span>
</li>
<li class="nav-item" data-depth="4">
<span class="nav-line">
<a class="nav-link" href="#cassandra:managing/tools/cassandra_stress.adoc">cassandra-stress</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../troubleshooting/index.html">Troubleshooting</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../troubleshooting/finding_nodes.html">Finding misbehaving nodes</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../troubleshooting/reading_logs.html">Reading Cassandra logs</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../troubleshooting/use_nodetool.html">Using nodetool</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../troubleshooting/use_tools.html">Using external tools to deep-dive</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<button class="nav-toggle"></button>
<a class="nav-link" href="../../reference/index.html">Reference</a>
</span>
<ul class="nav-list">
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/cql-commands/alter-table.html">ALTER TABLE</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/cql-commands/create-index.html">CREATE INDEX</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/cql-commands/create-custom-index.html">CREATE CUSTOM INDEX</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/cql-commands/create-table.html">CREATE TABLE</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/cql-commands/drop-index.html">DROP INDEX</a>
</span>
</li>
<li class="nav-item" data-depth="3">
<span class="nav-line">
<a class="nav-link" href="../../reference/cql-commands/drop-table.html">DROP TABLE</a>
</span>
</li>
</ul>
</li>
<li class="nav-item" data-depth="2">
<span class="nav-line">
<a class="nav-link" href="../../integrating/plugins/index.html">Plug-ins</a>
</span>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<aside class="toc sidebar">
<div class="toc-menu"></div>
</aside>
<main class="article default-main full-800" data-ceiling="topbar">
<div class="article-banner">
<p>You are viewing the documentation for a prerelease version.</p>
</div>
<div class="article-header">
<nav class="crumbs" aria-label="breadcrumbs">
<ul>
<li class="crumb">Cassandra</li>
<li class="crumb"><a href="index.html">Cassandra Query Language (CQL)</a></li>
<li class="crumb"><a href="cql_singlefile.html">Single file of CQL information</a></li>
</ul>
</nav>
<div class="tools" role="navigation">
<ul>
<li class="tool edit"><a href="https://github.com/apache/cassandra/edit/cassandra-5.0/doc/modules/cassandra/pages/developing/cql/cql_singlefile.adoc" title="Edit Page" target="_blank" rel="noopener">Edit</a></li>
</ul>
</div>
</div>
<article class="doc">
<h1 class="page">Cassandra Query Language (CQL) v3.4.3</h1>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>\{toc:maxLevel=3}</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="cql-syntax"><a class="anchor" href="#cql-syntax"></a>CQL Syntax</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="preamble"><a class="anchor" href="#preamble"></a>Preamble</h3>
<div class="paragraph">
<p>This document describes the Cassandra Query Language (CQL) version 3.
CQL v3 is not backward compatible with CQL v2 and differs from it in
numerous ways. Note that this document describes the last version of the
languages. However, the <a href="#changes">changes</a> section provides the diff
between the different versions of CQL v3.</p>
</div>
<div class="paragraph">
<p>CQL v3 offers a model very close to SQL in the sense that data is put in
<em>tables</em> containing <em>rows</em> of <em>columns</em>. For that reason, when used in
this document, these terms (tables, rows and columns) have the same
definition than they have in SQL. But please note that as such, they do
<strong>not</strong> refer to the concept of rows and columns found in the internal
implementation of Cassandra and in the thrift and CQL v2 API.</p>
</div>
</div>
<div class="sect2">
<h3 id="conventions"><a class="anchor" href="#conventions"></a>Conventions</h3>
<div class="paragraph">
<p>To aid in specifying the CQL syntax, we will use the following
conventions in this document:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Language rules will be given in a
<a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form">BNF</a> -like
notation:</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>bc(syntax). ::= TERMINAL</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Nonterminal symbols will have <code>&lt;angle brackets&gt;</code>.</p>
</li>
<li>
<p>As additional shortcut notations to BNF, we’ll use traditional regular
expression’s symbols (<code>?</code>, <code>+</code> and <code>*</code>) to signify that a given symbol
is optional and/or can be repeated. We’ll also allow parentheses to
group symbols and the <code>[&lt;characters&gt;]</code> notation to represent any one of
<code>&lt;characters&gt;</code>.</p>
</li>
<li>
<p>The grammar is provided for documentation purposes and leave some
minor details out. For instance, the last column definition in a
<code>CREATE TABLE</code> statement is optional but supported if present even
though the provided grammar in this document suggest it is not
supported.</p>
</li>
<li>
<p>Sample code will be provided in a code block:</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>bc(sample). SELECT sample_usage FROM cql;</p>
</div>
<div class="ulist">
<ul>
<li>
<p>References to keywords or pieces of CQL code in running text will be
shown in a <code>fixed-width font</code>.</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="identifiers"><a class="anchor" href="#identifiers"></a>Identifiers and keywords</h3>
<div class="paragraph">
<p>The CQL language uses <em>identifiers</em> (or <em>names</em>) to identify tables,
columns and other objects. An identifier is a token matching the regular
expression <code><code class="a-zA-Z">[a-zA-Z0-9_]</code>*</code>.</p>
</div>
<div class="paragraph">
<p>A number of such identifiers, like <code>SELECT</code> or <code>WITH</code>, are <em>keywords</em>.
They have a fixed meaning for the language and most are reserved. The
list of those keywords can be found in <a href="#appendixA">Appendix A</a>.</p>
</div>
<div class="paragraph">
<p>Identifiers and (unquoted) keywords are case insensitive. Thus <code>SELECT</code>
is the same than <code>select</code> or <code>sElEcT</code>, and <code>myId</code> is the same than
<code>myid</code> or <code>MYID</code> for instance. A convention often used (in particular by
the samples of this documentation) is to use upper case for keywords and
lower case for other identifiers.</p>
</div>
<div class="paragraph">
<p>There is a second kind of identifiers called <em>quoted identifiers</em>
defined by enclosing an arbitrary sequence of characters in
double-quotes(<code>"</code>). Quoted identifiers are never keywords. Thus
<code>"select"</code> is not a reserved keyword and can be used to refer to a
column, while <code>select</code> would raise a parse error. Also, contrarily to
unquoted identifiers and keywords, quoted identifiers are case sensitive
(<code>"My Quoted Id"</code> is <em>different</em> from <code>"my quoted id"</code>). A fully
lowercase quoted identifier that matches <code><code class="a-zA-Z">[a-zA-Z0-9_]</code>*</code> is
equivalent to the unquoted identifier obtained by removing the
double-quote (so <code>"myid"</code> is equivalent to <code>myid</code> and to <code>myId</code> but
different from <code>"myId"</code>). Inside a quoted identifier, the double-quote
character can be repeated to escape it, so <code>"foo "" bar"</code> is a valid
identifier.</p>
</div>
<div class="paragraph">
<p><strong>Warning</strong>: <em>quoted identifiers</em> allows to declare columns with arbitrary
names, and those can sometime clash with specific names used by the
server. For instance, when using conditional update, the server will
respond with a result-set containing a special result named
<code>"[applied]"</code>. If you’ve declared a column with such a name, this could
potentially confuse some tools and should be avoided. In general,
unquoted identifiers should be preferred but if you use quoted
identifiers, it is strongly advised to avoid any name enclosed by
squared brackets (like <code>"[applied]"</code>) and any name that looks like a
function call (like <code>"f(x)"</code>).</p>
</div>
</div>
<div class="sect2">
<h3 id="constants"><a class="anchor" href="#constants"></a>Constants</h3>
<div class="paragraph">
<p>CQL defines the following kind of <em>constants</em>: strings, integers,
floats, booleans, uuids and blobs:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>A string constant is an arbitrary sequence of characters characters
enclosed by single-quote(<code>'</code>). One can include a single-quote in a
string by repeating it, e.g. <code>'It''s raining today'</code>. Those are not to
be confused with quoted identifiers that use double-quotes.</p>
</li>
<li>
<p>An integer constant is defined by <code>'-'?[0-9]+</code>.</p>
</li>
<li>
<p>A float constant is defined by
<code>'-'?[0-9]+('.'[0-9]*)?([eE][+-]?[0-9+])?</code>. On top of that, <code>NaN</code> and
<code>Infinity</code> are also float constants.</p>
</li>
<li>
<p>A boolean constant is either <code>true</code> or <code>false</code> up to
case-insensitivity (i.e. <code>True</code> is a valid boolean constant).</p>
</li>
<li>
<p>A <a href="http://en.wikipedia.org/wiki/Universally_unique_identifier">UUID</a>
constant is defined by <code>hex{8}-hex{4}-hex{4}-hex{4}-hex{12}</code> where <code>hex</code>
is an hexadecimal character, e.g. <code>[0-9a-fA-F]</code> and <code>{4}</code> is the number
of such characters.</p>
</li>
<li>
<p>A blob constant is an hexadecimal number defined by <code>0[xX](hex)+</code>
where <code>hex</code> is an hexadecimal character, e.g. <code>[0-9a-fA-F]</code>.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>For how these constants are typed, see the <a href="#types">data types
section</a>.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="terms"><a class="anchor" href="#terms"></a>Terms</h2>
<div class="sectionbody">
<div class="paragraph">
<p>CQL has the notion of a <em>term</em>, which denotes the kind of values that
CQL support. Terms are defined by:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-bnf hljs" data-lang="bnf">term::= constant | literal | function_call | arithmetic_operation | type_hint | bind_marker
literal::= collection_literal | vector_literal | udt_literal | tuple_literal
function_call::= identifier '(' [ term (',' term)* ] ')'
arithmetic_operation::= '-' term | term ('+' | '-' | '*' | '/' | '%') term
type_hint::= '(' cql_type ')' term
bind_marker::= '?' | ':' identifier</code></pre>
</div>
</div>
<div class="paragraph">
<p>A term is thus one of:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>A <a href="#cassandra:developing/cql/defintions.adoc#constants" class="page unresolved">constant</a></p>
</li>
<li>
<p>A literal for either a <a href="types.html#collections" class="page">collection</a>, a <a href="types.html#vectors" class="page">vector</a>,
a <a href="types.html#udts" class="page">user-defined type</a> or a <a href="types.html#tuples" class="page">tuple</a></p>
</li>
<li>
<p>A <a href="functions.html#cql-functions" class="page">function</a> call, either a <a href="functions.html#scalar-native-functions" class="page">native function</a>
or a <a href="functions.html#user-defined-scalar-functions" class="page">user-defined function</a></p>
</li>
<li>
<p>An <a href="operators.html#arithmetic_operators" class="page">arithmetic operation</a> between terms</p>
</li>
<li>
<p>A type hint</p>
</li>
<li>
<p>A bind marker, which denotes a variable to be bound at execution time.
See the section on <code>prepared-statements</code> for details. A bind marker can
be either anonymous (<code>?</code>) or named (<code>:some_name</code>). The latter form
provides a more convenient way to refer to the variable for binding it
and should generally be preferred.</p>
</li>
</ul>
</div>
<div class="sect2">
<h3 id="comments"><a class="anchor" href="#comments"></a>Comments</h3>
<div class="paragraph">
<p>A comment in CQL is a line beginning by either double dashes (<code>--</code>) or
double slash (<code>//</code>).</p>
</div>
<div class="paragraph">
<p>Multi-line comments are also supported through enclosure within <code>/<strong></code> and
<code></strong>/</code> (but nesting is not supported).</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
— This is a comment<br>
/* This is<br>
a multi-line comment */</p>
</div>
</div>
<div class="sect2">
<h3 id="statements"><a class="anchor" href="#statements"></a>Statements</h3>
<div class="paragraph">
<p>CQL consists of statements. As in SQL, these statements can be divided
in 3 categories:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Data definition statements, that allow to set and change the way data
is stored.</p>
</li>
<li>
<p>Data manipulation statements, that allow to change data</p>
</li>
<li>
<p>Queries, to look up data</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>All statements end with a semicolon (<code>;</code>) but that semicolon can be
omitted when dealing with a single statement. The supported statements
are described in the following sections. When describing the grammar of
said statements, we will reuse the non-terminal symbols defined below:</p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= any quoted or unquoted identifier, excluding reserved keywords<br>
::= ( `.')?</p>
</div>
<div class="paragraph">
<p>::= a string constant<br>
::= an integer constant<br>
::= a float constant<br>
::= | <br>
::= a uuid constant<br>
::= a boolean constant<br>
::= a blob constant</p>
</div>
<div class="paragraph">
<p>::= <br>
| <br>
| <br>
| <br>
| <br>
::= <code>?'<br>
| `:' <br>
::= <br>
| <br>
| <br>
| `(' ( (</code>,' )*)? `)'</p>
</div>
<div class="paragraph">
<p>::= <br>
| <br>
| <br>
::= `\{' ( `:' ( `,' `:' )* )? `}'<br>
::= `\{' ( ( `,' )* )? `}'<br>
::= `[' ( ( `,' )* )? `]'</p>
</div>
<div class="paragraph">
<p>::=</p>
</div>
<div class="paragraph">
<p>::= (AND )*<br>
::= <code>=' ( | | )<br>
p.<br>
Please note that not every possible productions of the grammar above
will be valid in practice. Most notably, `&lt;variable&gt;</code> and nested
<code>&lt;collection-literal&gt;</code> are currently not allowed inside
<code>&lt;collection-literal&gt;</code>.</p>
</div>
<div class="paragraph">
<p>A <code>&lt;variable&gt;</code> can be either anonymous (a question mark (<code>?</code>)) or named
(an identifier preceded by <code>:</code>). Both declare a bind variables for
<a href="#preparedStatement">prepared statements</a>. The only difference
between an anymous and a named variable is that a named one will be
easier to refer to (how exactly depends on the client driver used).</p>
</div>
<div class="paragraph">
<p>The <code>&lt;properties&gt;</code> production is use by statement that create and alter
keyspaces and tables. Each <code>&lt;property&gt;</code> is either a <em>simple</em> one, in
which case it just has a value, or a <em>map</em> one, in which case it’s value
is a map grouping sub-options. The following will refer to one or the
other as the <em>kind</em> (<em>simple</em> or <em>map</em>) of the property.</p>
</div>
<div class="paragraph">
<p>A <code>&lt;tablename&gt;</code> will be used to identify a table. This is an identifier
representing the table name that can be preceded by a keyspace name. The
keyspace name, if provided, allow to identify a table in another
keyspace than the currently active one (the currently active keyspace is
set through the <code>USE</code> statement).</p>
</div>
<div class="paragraph">
<p>For supported <code>&lt;function&gt;</code>, see the section on
<a href="#functions">functions</a>.</p>
</div>
<div class="paragraph">
<p>Strings can be either enclosed with single quotes or two dollar
characters. The second syntax has been introduced to allow strings that
contain single quotes. Typical candidates for such strings are source
code fragments for user-defined functions.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
`some string value'</p>
</div>
<div class="paragraph">
<p>double-dollar string can contain single ’ quotes<br>
p.</p>
</div>
</div>
<div class="sect2">
<h3 id="preparedStatement"><a class="anchor" href="#preparedStatement"></a>Prepared Statement</h3>
<div class="paragraph">
<p>CQL supports <em>prepared statements</em>. Prepared statement is an
optimization that allows to parse a query only once but execute it
multiple times with different concrete values.</p>
</div>
<div class="paragraph">
<p>In a statement, each time a column value is expected (in the data
manipulation and query statements), a <code>&lt;variable&gt;</code> (see above) can be
used instead. A statement with bind variables must then be <em>prepared</em>.
Once it has been prepared, it can executed by providing concrete values
for the bind variables. The exact procedure to prepare a statement and
execute a prepared statement depends on the CQL driver used and is
beyond the scope of this document.</p>
</div>
<div class="paragraph">
<p>In addition to providing column values, bind markers may be used to
provide values for <code>LIMIT</code>, <code>TIMESTAMP</code>, and <code>TTL</code> clauses. If anonymous
bind markers are used, the names for the query parameters will be
<code>[limit]</code>, <code>[timestamp]</code>, and <code>[ttl]</code>, respectively.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="dataDefinition"><a class="anchor" href="#dataDefinition"></a>Data Definition</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="createKeyspaceStmt"><a class="anchor" href="#createKeyspaceStmt"></a>CREATE KEYSPACE</h3>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE KEYSPACE (IF NOT EXISTS)? WITH <br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE KEYSPACE Excelsior<br>
WITH replication = \{’class’: `SimpleStrategy', `replication_factor' :
3};</p>
</div>
<div class="paragraph">
<p>CREATE KEYSPACE Excalibur<br>
WITH replication = \{’class’: <code>NetworkTopologyStrategy', `DC1' : 1,
`DC2' : 3}<br>
AND durable_writes = false;<br>
p.<br>
The `CREATE KEYSPACE</code> statement creates a new top-level <em>keyspace</em>. A
keyspace is a namespace that defines a replication strategy and some
options for a set of tables. Valid keyspaces names are identifiers
composed exclusively of alphanumerical characters and whose length is
lesser or equal to 32. Note that as identifiers, keyspace names are case
insensitive: use a quoted identifier for case sensitive keyspace names.</p>
</div>
<div class="paragraph">
<p>The supported <code>&lt;properties&gt;</code> for <code>CREATE KEYSPACE</code> are:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">name</th>
<th class="tableblock halign-left valign-top">kind</th>
<th class="tableblock halign-left valign-top">mandatory</th>
<th class="tableblock halign-left valign-top">default</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>replication</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>map</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The replication strategy and options to
use for the keyspace.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>durable_writes</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>simple</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Whether to use the commit log for
updates on this keyspace (disable this option at your own risk!).</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>The <code>replication</code> <code>&lt;property&gt;</code> is mandatory. It must at least contains
the <code>'class'</code> sub-option which defines the replication strategy class to
use. The rest of the sub-options depends on that replication strategy
class. By default, Cassandra support the following <code>'class'</code>:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>'SimpleStrategy'</code>: A simple strategy that defines a simple
replication factor for the whole cluster. The only sub-options supported
is <code>'replication_factor'</code> to define that replication factor and is
mandatory.</p>
</li>
<li>
<p><code>'NetworkTopologyStrategy'</code>: A replication strategy that allows to set
the replication factor independently for each data-center. The rest of
the sub-options are key-value pairs where each time the key is the name
of a datacenter and the value the replication factor for that
data-center.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Attempting to create an already existing keyspace will return an error
unless the <code>IF NOT EXISTS</code> option is used. If it is used, the statement
will be a no-op if the keyspace already exists.</p>
</div>
</div>
<div class="sect2">
<h3 id="useStmt"><a class="anchor" href="#useStmt"></a>USE</h3>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= USE</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample). USE myApp;</p>
</div>
<div class="paragraph">
<p>The <code>USE</code> statement takes an existing keyspace name as argument and set
it as the per-connection current working keyspace. All subsequent
keyspace-specific actions will be performed in the context of the
selected keyspace, unless <a href="#statements">otherwise specified</a>, until
another USE statement is issued or the connection terminates.</p>
</div>
</div>
<div class="sect2">
<h3 id="alterKeyspaceStmt"><a class="anchor" href="#alterKeyspaceStmt"></a>ALTER KEYSPACE</h3>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= ALTER KEYSPACE (IF EXISTS)? WITH <br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
ALTER KEYSPACE Excelsior<br>
WITH replication = \{’class’: `SimpleStrategy', `replication_factor' :
4};</p>
</div>
<div class="paragraph">
<p>The <code>ALTER KEYSPACE</code> statement alters the properties of an existing
keyspace. The supported <code>&lt;properties&gt;</code> are the same as for the
<a href="#createKeyspaceStmt"><code>CREATE KEYSPACE</code></a> statement.</p>
</div>
</div>
<div class="sect2">
<h3 id="dropKeyspaceStmt"><a class="anchor" href="#dropKeyspaceStmt"></a>DROP KEYSPACE</h3>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= DROP KEYSPACE ( IF EXISTS )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample). DROP KEYSPACE myApp;</p>
</div>
<div class="paragraph">
<p>A <code>DROP KEYSPACE</code> statement results in the immediate, irreversible
removal of an existing keyspace, including all column families in it,
and all data contained in those column families.</p>
</div>
<div class="paragraph">
<p>If the keyspace does not exists, the statement will return an error,
unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
</div>
<div class="sect2">
<h3 id="createTableStmt"><a class="anchor" href="#createTableStmt"></a>CREATE TABLE</h3>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE ( TABLE | COLUMNFAMILY ) ( IF NOT EXISTS )? <br>
`(' ( `,' )* `)'<br>
( WITH ( AND )* )?</p>
</div>
<div class="paragraph">
<p>::= ( STATIC )? ( PRIMARY KEY )?<br>
| PRIMARY KEY `(' ( `,' )* `)'</p>
</div>
<div class="paragraph">
<p>::= <br>
| <code>(' (</code>,' )* `)'</p>
</div>
<div class="paragraph">
<p>::= <br>
| COMPACT STORAGE<br>
| CLUSTERING ORDER<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE TABLE monkeySpecies (<br>
species text PRIMARY KEY,<br>
common_name text,<br>
population varint,<br>
average_size int<br>
) WITH comment=`Important biological records';</p>
</div>
<div class="paragraph">
<p>CREATE TABLE timeline (<br>
userid uuid,<br>
posted_month int,<br>
posted_time uuid,<br>
body text,<br>
posted_by text,<br>
PRIMARY KEY (userid, posted_month, posted_time)<br>
) WITH compaction = \{ <code>class' : `LeveledCompactionStrategy' };<br>
p.<br>
The `CREATE TABLE</code> statement creates a new table. Each such table is a
set of <em>rows</em> (usually representing related entities) for which it
defines a number of properties. A table is defined by a
<a href="#createTableName">name</a>, it defines the columns composing rows of
the table and have a number of <a href="#createTableOptions">options</a>. Note
that the <code>CREATE COLUMNFAMILY</code> syntax is supported as an alias for
<code>CREATE TABLE</code> (for historical reasons).</p>
</div>
<div class="paragraph">
<p>Attempting to create an already existing table will return an error
unless the <code>IF NOT EXISTS</code> option is used. If it is used, the statement
will be a no-op if the table already exists.</p>
</div>
<div class="sect3">
<h4 id="createTableName"><a class="anchor" href="#createTableName"></a><code>&lt;tablename&gt;</code></h4>
<div class="paragraph">
<p>Valid table names are the same as valid
<a href="#createKeyspaceStmt">keyspace names</a> (up to 32 characters long
alphanumerical identifiers). If the table name is provided alone, the
table is created within the current keyspace (see <code>USE</code>), but if it is
prefixed by an existing keyspace name (see
<a href="#statements"><code>&lt;tablename&gt;</code></a> grammar), it is created in the specified
keyspace (but does <strong>not</strong> change the current keyspace).</p>
</div>
</div>
<div class="sect3">
<h4 id="createTableColumn"><a class="anchor" href="#createTableColumn"></a><code>&lt;column-definition&gt;</code></h4>
<div class="paragraph">
<p>A <code>CREATE TABLE</code> statement defines the columns that rows of the table
can have. A <em>column</em> is defined by its name (an identifier) and its type
(see the <a href="#types">data types</a> section for more details on allowed
types and their properties).</p>
</div>
<div class="paragraph">
<p>Within a table, a row is uniquely identified by its <code>PRIMARY KEY</code> (or
more simply the key), and hence all table definitions <strong>must</strong> define a
PRIMARY KEY (and only one). A <code>PRIMARY KEY</code> is composed of one or more
of the columns defined in the table. If the <code>PRIMARY KEY</code> is only one
column, this can be specified directly after the column definition.
Otherwise, it must be specified by following <code>PRIMARY KEY</code> by the
comma-separated list of column names composing the key within
parenthesis. Note that:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE t (<br>
k int PRIMARY KEY,<br>
other text<br>
)</p>
</div>
<div class="paragraph">
<p>is equivalent to</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE t (<br>
k int,<br>
other text,<br>
PRIMARY KEY (k)<br>
)</p>
</div>
</div>
<div class="sect3">
<h4 id="createTablepartitionClustering"><a class="anchor" href="#createTablepartitionClustering"></a>Partition key and clustering columns</h4>
<div class="paragraph">
<p>In CQL, the order in which columns are defined for the <code>PRIMARY KEY</code>
matters. The first column of the key is called the <em>partition key</em>. It
has the property that all the rows sharing the same partition key (even
across table in fact) are stored on the same physical node. Also,
insertion/update/deletion on rows sharing the same partition key for a
given table are performed <em>atomically</em> and in <em>isolation</em>. Note that it
is possible to have a composite partition key, i.e. a partition key
formed of multiple columns, using an extra set of parentheses to define
which columns forms the partition key.</p>
</div>
<div class="paragraph">
<p>The remaining columns of the <code>PRIMARY KEY</code> definition, if any, are
called __clustering columns. On a given physical node, rows for a given
partition key are stored in the order induced by the clustering columns,
making the retrieval of rows in that clustering order particularly
efficient (see <code>SELECT</code>).</p>
</div>
</div>
<div class="sect3">
<h4 id="createTableStatic"><a class="anchor" href="#createTableStatic"></a><code>STATIC</code> columns</h4>
<div class="paragraph">
<p>Some columns can be declared as <code>STATIC</code> in a table definition. A column
that is static will be ``shared'' by all the rows belonging to the same
partition (having the same partition key). For instance, in:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE test (<br>
pk int,<br>
t int,<br>
v text,<br>
s text static,<br>
PRIMARY KEY (pk, t)<br>
);<br>
INSERT INTO test(pk, t, v, s) VALUES (0, 0, `val0', `static0');<br>
INSERT INTO test(pk, t, v, s) VALUES (0, 1, `val1', `static1');<br>
SELECT * FROM test WHERE pk=0 AND t=0;</p>
</div>
<div class="paragraph">
<p>the last query will return <code>'static1'</code> as value for <code>s</code>, since <code>s</code> is
static and thus the 2nd insertion modified this <code>`shared'' value. Note
however that static columns are only static within a given partition,
and if in the example above both rows where from different partitions
(i.e. if they had different value for `pk</code>), then the 2nd insertion
would not have modified the value of <code>s</code> for the first row.</p>
</div>
<div class="paragraph">
<p>A few restrictions applies to when static columns are allowed:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>tables with the <code>COMPACT STORAGE</code> option (see below) cannot have them</p>
</li>
<li>
<p>a table without clustering columns cannot have static columns (in a
table without clustering columns, every partition has only one row, and
so every column is inherently static).</p>
</li>
<li>
<p>only non <code>PRIMARY KEY</code> columns can be static</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="createTableOptions"><a class="anchor" href="#createTableOptions"></a><code>&lt;option&gt;</code></h4>
<div class="paragraph">
<p>The <code>CREATE TABLE</code> statement supports a number of options that controls
the configuration of a new table. These options can be specified after
the <code>WITH</code> keyword.</p>
</div>
<div class="paragraph">
<p>The first of these option is <code>COMPACT STORAGE</code>. This option is mainly
targeted towards backward compatibility for definitions created before
CQL3 (see
<a href="http://www.datastax.com/dev/blog/thrift-to-cql3">www.datastax.com/dev/blog/thrift-to-cql3</a>
for more details). The option also provides a slightly more compact
layout of data on disk but at the price of diminished flexibility and
extensibility for the table. Most notably, <code>COMPACT STORAGE</code> tables
cannot have collections nor static columns and a <code>COMPACT STORAGE</code> table
with at least one clustering column supports exactly one (as in not 0
nor more than 1) column not part of the <code>PRIMARY KEY</code> definition (which
imply in particular that you cannot add nor remove columns after
creation). For those reasons, <code>COMPACT STORAGE</code> is not recommended
outside of the backward compatibility reason evoked above.</p>
</div>
<div class="paragraph">
<p>Another option is <code>CLUSTERING ORDER</code>. It allows to define the ordering
of rows on disk. It takes the list of the clustering column names with,
for each of them, the on-disk order (Ascending or descending). Note that
this option affects <a href="#selectOrderBy">what <code>ORDER BY</code> are allowed
during <code>SELECT</code></a>.</p>
</div>
<div class="paragraph">
<p>Table creation supports the following other <code>&lt;property&gt;</code>:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">option</th>
<th class="tableblock halign-left valign-top">kind</th>
<th class="tableblock halign-left valign-top">default</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>comment</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>simple</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">none</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A free-form, human-readable comment.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>gc_grace_seconds</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>simple</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">864000</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Time to wait before garbage
collecting tombstones (deletion markers).</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bloom_filter_fp_chance</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>simple</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">0.00075</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The target probability of
false positive of the sstable bloom filters. Said bloom filters will be
sized to provide the provided probability (thus lowering this value
impact the size of bloom filters in-memory and on-disk)</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>default_time_to_live</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>simple</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">0</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The default expiration time
(``TTL'') in seconds for a table.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>compaction</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>map</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>see below</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Compaction options, see
<a href="#compactionOptions">below</a>.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>compression</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>map</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>see below</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Compression options, see
<a href="#compressionOptions">below</a>.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>caching</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>map</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>see below</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Caching options, see
<a href="#cachingOptions">below</a>.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>crc_check_chance</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">simple</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1.0</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">This option defines the probability with which checksums
should be checked during reads to detect bit rot and prevent the propagation of corruption
to other replicas. The default value is 1 to apply a checksum every time a data chunk is read.
Set to 0 to disable checksum checking and to 0.5 for instance to check every other read.</p>
<p class="tableblock">Due to technical limitations we only currently apply this for compressed files.
If compression is not enabled on the table, no checksums will be verified.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="compactionOptions"><a class="anchor" href="#compactionOptions"></a>Compaction options</h4>
<div class="paragraph">
<p>The <code>compaction</code> property must at least define the <code>'class'</code> sub-option,
that defines the compaction strategy class to use. The default supported
class are <code>'SizeTieredCompactionStrategy'</code>,
<code>'LeveledCompactionStrategy'</code> and
<code>'TimeWindowCompactionStrategy'</code>. Custom strategy can be provided by
specifying the full class name as a <a href="#constants">string constant</a>.
The rest of the sub-options depends on the chosen class. The sub-options
supported by the default classes are:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">option</th>
<th class="tableblock halign-left valign-top">supported compaction strategy</th>
<th class="tableblock halign-left valign-top">default</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>enabled</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>all</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A boolean denoting whether compaction should be
enabled or not.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tombstone_threshold</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>all</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">0.2</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A ratio such that if a sstable has
more than this ratio of gcable tombstones over all contained columns,
the sstable will be compacted (with no other sstables) for the purpose
of purging those tombstones.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tombstone_compaction_interval</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>all</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1 day</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The minimum time to wait
after an sstable creation time before considering it for <code>tombstone
compaction'', where </code>tombstone compaction'' is the compaction triggered
if the sstable has more gcable tombstones than <code>tombstone_threshold</code>.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>unchecked_tombstone_compaction</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>all</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Setting this to true
enables more aggressive tombstone compactions - single sstable tombstone
compactions will run without checking how likely it is that they will be
successful.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>min_sstable_size</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SizeTieredCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">50MB</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The size tiered
strategy groups SSTables to compact in buckets. A bucket groups SSTables
that differs from less than 50% in size. However, for small sizes, this
would result in a bucketing that is too fine grained. <code>min_sstable_size</code>
defines a size threshold (in bytes) below which all SSTables belong to
one unique bucket</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>min_threshold</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SizeTieredCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">4</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Minimum number of
SSTables needed to start a minor compaction.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>max_threshold</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SizeTieredCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">32</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Maximum number of
SSTables processed by one minor compaction.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bucket_low</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SizeTieredCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">0.5</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Size tiered consider
sstables to be within the same bucket if their size is within
[average_size * <code>bucket_low</code>, average_size * <code>bucket_high</code> ] (i.e the
default groups sstable whose sizes diverges by at most 50%)</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bucket_high</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">SizeTieredCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1.5</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Size tiered consider
sstables to be within the same bucket if their size is within
[average_size * <code>bucket_low</code>, average_size * <code>bucket_high</code> ] (i.e the
default groups sstable whose sizes diverges by at most 50%).</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>sstable_size_in_mb</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">LeveledCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">5MB</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The target size
(in MB) for sstables in the leveled strategy. Note that while sstable
sizes should stay less or equal to <code>sstable_size_in_mb</code>, it is possible
to exceptionally have a larger sstable as during compaction, data for a
given partition key are never split into 2 sstables</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp_resolution</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">TimeWindowCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">MICROSECONDS</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The
timestamp resolution used when inserting data, could be MILLISECONDS,
MICROSECONDS etc (should be understandable by Java TimeUnit) - don’t
change this unless you do mutations with USING TIMESTAMP (or equivalent
directly in the client)</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>compaction_window_unit</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">TimeWindowCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">DAYS</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The Java
TimeUnit used for the window size, set in conjunction with
<code>compaction_window_size</code>. Must be one of DAYS, HOURS, MINUTES</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>compaction_window_size</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">TimeWindowCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The number
of <code>compaction_window_unit</code> units that make up a time window.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>unsafe_aggressive_sstable_expiration</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">TimeWindowCompactionStrategy</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Expired sstables will be dropped without checking its data is
shadowing other sstables. This is a potentially risky option that can
lead to data loss or deleted data re-appearing, going beyond what
<code>unchecked_tombstone_compaction</code> does for single sstable compaction. Due
to the risk the jvm must also be started with
<code>-Dcassandra.unsafe_aggressive_sstable_expiration=true</code>.</p></td>
</tr>
</tbody>
</table>
<div class="sect4">
<h5 id="compressionOptions"><a class="anchor" href="#compressionOptions"></a>Compression options</h5>
<div class="paragraph">
<p>For the <code>compression</code> property, the following sub-options are available:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.667%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">option</th>
<th class="tableblock halign-left valign-top">default</th>
<th class="tableblock halign-left valign-top">description</th>
<th class="tableblock halign-left valign-top"></th>
<th class="tableblock halign-left valign-top"></th>
<th class="tableblock halign-left valign-top"></th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>class</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">LZ4Compressor</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The compression algorithm to use. Default
compressor are: LZ4Compressor, SnappyCompressor and DeflateCompressor.
Use <code>'enabled' : false</code> to disable compression. Custom compressor can be
provided by specifying the full class name as a <a href="#constants">string
constant</a>.</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>enabled</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">By default compression is enabled. To disable it, set
<code>enabled</code> to <code>false</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>chunk_length_in_kb</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">64KB</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">On disk SSTables are
compressed by block (to allow random reads). This defines the size (in
KB) of said block. Bigger values may improve the compression rate, but
increases the minimum size of data to be read from disk for a read</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
<h5 id="cachingOptions"><a class="anchor" href="#cachingOptions"></a>Caching options</h5>
<div class="paragraph">
<p>For the <code>caching</code> property, the following sub-options are available:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">option</th>
<th class="tableblock halign-left valign-top">default</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>keys</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ALL</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Whether to cache keys (<code>`key cache'') for this table.
Valid values are: `ALL</code> and <code>NONE</code>.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>rows_per_partition</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">NONE</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The amount of rows to cache per partition
(<code>`row cache''). If an integer `n</code> is specified, the first <code>n</code> queried
rows of a partition will be cached. Other possible options are <code>ALL</code>, to
cache all rows of a queried partition, or <code>NONE</code> to disable row caching.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
<h5 id="other-considerations"><a class="anchor" href="#other-considerations"></a>Other considerations:</h5>
<div class="ulist">
<ul>
<li>
<p>When <a href="#insertStmt">inserting</a> / <a href="#updateStmt">updating</a> a given
row, not all columns needs to be defined (except for those part of the
key), and missing columns occupy no space on disk. Furthermore, adding
new columns (see <code>ALTER TABLE</code>) is a constant time operation. There is
thus no need to try to anticipate future usage (or to cry when you
haven’t) when creating a table.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect3">
<h4 id="alterTableStmt"><a class="anchor" href="#alterTableStmt"></a>ALTER TABLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= ALTER (TABLE | COLUMNFAMILY) (IF EXISTS)?</p>
</div>
<div class="paragraph">
<p>::= ADD (IF NOT EXISTS)?<br>
| ADD (IF NOT EXISTS)? ( ( , )* )<br>
| DROP (IF EXISTS)? <br>
| DROP (IF EXISTS)? ( ( , )* )<br>
| RENAME (IF EXISTS)? TO (AND TO)*<br>
| WITH ( AND )*<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
ALTER TABLE addamsFamily</p>
</div>
<div class="paragraph">
<p>ALTER TABLE addamsFamily<br>
ADD gravesite varchar;</p>
</div>
<div class="paragraph">
<p>ALTER TABLE addamsFamily<br>
WITH comment = <code>A most excellent and useful column family';<br>
p.<br>
The `ALTER</code> statement is used to manipulate table definitions. It allows
for adding new columns, dropping existing ones, or updating the table
options. As with table creation, <code>ALTER COLUMNFAMILY</code> is allowed as an
alias for <code>ALTER TABLE</code>.
If the table does not exist, the statement will return an error, unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
<div class="paragraph">
<p>The <code>&lt;tablename&gt;</code> is the table name optionally preceded by the keyspace
name. The <code>&lt;instruction&gt;</code> defines the alteration to perform:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>ADD</code>: Adds a new column to the table. The <code>&lt;identifier&gt;</code> for the new
column must not conflict with an existing column. Moreover, columns
cannot be added to tables defined with the <code>COMPACT STORAGE</code> option.
If the new column already exists, the statement will return an error, unless <code>IF NOT EXISTS</code> is used in which case the operation is a no-op.</p>
</li>
<li>
<p><code>DROP</code>: Removes a column from the table. Dropped columns will
immediately become unavailable in the queries and will not be included
in compacted sstables in the future. If a column is readded, queries
won’t return values written before the column was last dropped. It is
assumed that timestamps represent actual time, so if this is not your
case, you should NOT read previously dropped columns. Columns can’t be
dropped from tables defined with the <code>COMPACT STORAGE</code> option.
If the dropped column does not already exist, the statement will return an error, unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</li>
<li>
<p><code>RENAME</code> a primary key column of a table. Non primary key columns cannot be renamed.
Furthermore, renaming a column to another name which already exists isn&#8217;t allowed.
It&#8217;s important to keep in mind that renamed columns shouldn&#8217;t have dependent seconday indexes.
If the renamed column does not already exist, the statement will return an error, unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</li>
<li>
<p><code>WITH</code>: Allows to update the options of the table. The
<a href="#createTableOptions">supported <code>&lt;option&gt;</code></a> (and syntax) are the same
as for the <code>CREATE TABLE</code> statement except that <code>COMPACT STORAGE</code> is not
supported. Note that setting any <code>compaction</code> sub-options has the effect
of erasing all previous <code>compaction</code> options, so you need to re-specify
all the sub-options if you want to keep them. The same note applies to
the set of <code>compression</code> sub-options.</p>
</li>
</ul>
</div>
<div class="sect4">
<h5 id="cql-type-compatibility"><a class="anchor" href="#cql-type-compatibility"></a>CQL type compatibility:</h5>
<div class="paragraph">
<p>CQL data types may be converted only as the following table.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Data type may be altered to:</th>
<th class="tableblock halign-left valign-top">Data type</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">timestamp</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">bigint</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ascii, bigint, boolean, date, decimal, double, float, inet, int,
smallint, text, time, timestamp, timeuuid, tinyint, uuid, varchar,
varint</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">blob</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">date</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ascii, varchar</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">text</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">bigint</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">time</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">bigint</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">timestamp</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">timeuuid</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">uuid</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ascii, text</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">varchar</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">bigint, int, timestamp</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">varint</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Clustering columns have stricter requirements, only the below
conversions are allowed.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Data type may be altered to:</th>
<th class="tableblock halign-left valign-top">Data type</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ascii, text, varchar</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">blob</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ascii, varchar</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">text</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">ascii, text</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">varchar</p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="sect3">
<h4 id="dropTableStmt"><a class="anchor" href="#dropTableStmt"></a>DROP TABLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= DROP TABLE ( IF EXISTS )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample). DROP TABLE worldSeriesAttendees;</p>
</div>
<div class="paragraph">
<p>The <code>DROP TABLE</code> statement results in the immediate, irreversible
removal of a table, including all data contained in it. As for table
creation, <code>DROP COLUMNFAMILY</code> is allowed as an alias for <code>DROP TABLE</code>.</p>
</div>
<div class="paragraph">
<p>If the table does not exist, the statement will return an error, unless
<code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="truncateStmt"><a class="anchor" href="#truncateStmt"></a>TRUNCATE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= TRUNCATE ( TABLE | COLUMNFAMILY )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample). TRUNCATE superImportantData;</p>
</div>
<div class="paragraph">
<p>The <code>TRUNCATE</code> statement permanently removes all data from a table.</p>
</div>
</div>
<div class="sect3">
<h4 id="createIndexStmt"><a class="anchor" href="#createIndexStmt"></a>CREATE INDEX</h4>
<div class="paragraph">
<p>The <code>CREATE INDEX</code> statement is used to create a new
secondary index for a given (existing) column in a given table. A name
for the index itself can be specified before the <code>ON</code> keyword, if
desired.</p>
</div>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE ( CUSTOM )? INDEX ( IF NOT EXISTS )? ( )?<br>
ON `(' `)'<br>
( USING ( WITH OPTIONS = )? )?</p>
</div>
<div class="paragraph">
<p>::= <br>
| keys( )<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE INDEX userIndex ON NerdMovies (user);<br>
CREATE INDEX ON Mutants (abilityId);<br>
CREATE INDEX ON users (keys(favs));<br>
CREATE INDEX ON users (age) USING 'sai';<br>
CREATE CUSTOM INDEX ON users (email) USING `path.to.the.IndexClass';<br>
CREATE CUSTOM INDEX ON users (email) USING `path.to.the.IndexClass' WITH
OPTIONS = \{’storage’: `/mnt/ssd/indexes/'};</p>
</div>
<div class="paragraph">
<p>If data already exists for the column, it will be indexed
asynchronously. After the index is created, new data for the column is
indexed automatically at insertion time. Attempting to create an already
existing index will return an error unless the <code>IF NOT EXISTS</code> option is used.
If it is used, the statement will be a no-op if the index already exists.</p>
</div>
<div class="sect4">
<h5 id="indexTypes"><a class="anchor" href="#indexTypes"></a>Index Types</h5>
<div class="paragraph">
<p>The <code>USING</code> keyword optionally specifies an index type. There are two built-in types:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>legacy_local_table - (default) legacy secondary index, implemented as a hidden local table</p>
</li>
<li>
<p>sai - "storage-attched" index, implemented via optimized SSTable/Memtable-attached indexes</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>To create a custom index, a fully qualified class name must be specified.</p>
</div>
</div>
<div class="sect4">
<h5 id="keysIndex"><a class="anchor" href="#keysIndex"></a>Indexes on Map Keys</h5>
<div class="paragraph">
<p>When creating an index on a <a href="#map">map column</a>, you may index either
the keys or the values. If the column identifier is placed within the
<code>keys()</code> function, the index will be on the map keys, allowing you to
use <code>CONTAINS KEY</code> in <code>WHERE</code> clauses. Otherwise, the index will be on
the map values.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="dropIndexStmt"><a class="anchor" href="#dropIndexStmt"></a>DROP INDEX</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= DROP INDEX ( IF EXISTS )? ( `.' )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
DROP INDEX userIndex;</p>
</div>
<div class="paragraph">
<p>DROP INDEX userkeyspace.address_index;<br>
p.<br>
The <code>DROP INDEX</code> statement is used to drop an existing secondary index.
The argument of the statement is the index name, which may optionally
specify the keyspace of the index.</p>
</div>
<div class="paragraph">
<p>If the index does not exists, the statement will return an error, unless
<code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="createMVStmt"><a class="anchor" href="#createMVStmt"></a>CREATE MATERIALIZED VIEW</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE MATERIALIZED VIEW ( IF NOT EXISTS )? AS<br>
SELECT ( `(' ( `,' ) * `)' | `<strong>' )<br>
FROM <br>
( WHERE )?<br>
PRIMARY KEY `(' ( `,' )</strong> `)'<br>
( WITH ( AND )* )?<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE MATERIALIZED VIEW monkeySpecies_by_population AS<br>
SELECT *<br>
FROM monkeySpecies<br>
WHERE population IS NOT NULL AND species IS NOT NULL<br>
PRIMARY KEY (population, species)<br>
WITH comment=<code>Allow query by population instead of species';<br>
p.<br>
The `CREATE MATERIALIZED VIEW</code> statement creates a new materialized
view. Each such view is a set of <em>rows</em> which corresponds to rows which
are present in the underlying, or base, table specified in the <code>SELECT</code>
statement. A materialized view cannot be directly updated, but updates
to the base table will cause corresponding updates in the view.</p>
</div>
<div class="paragraph">
<p>Attempting to create an already existing materialized view will return
an error unless the <code>IF NOT EXISTS</code> option is used. If it is used, the
statement will be a no-op if the materialized view already exists.</p>
</div>
<div class="sect4">
<h5 id="createMVWhere"><a class="anchor" href="#createMVWhere"></a><code>WHERE</code> Clause</h5>
<div class="paragraph">
<p>The <code>&lt;where-clause&gt;</code> is similar to the <a href="#selectWhere">where clause of
a <code>SELECT</code> statement</a>, with a few differences. First, the where clause
must contain an expression that disallows <code>NULL</code> values in columns in
the view’s primary key. If no other restriction is desired, this can be
accomplished with an <code>IS NOT NULL</code> expression. Second, only columns
which are in the base table’s primary key may be restricted with
expressions other than <code>IS NOT NULL</code>. (Note that this second restriction
may be lifted in the future.)</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="alterMVStmt"><a class="anchor" href="#alterMVStmt"></a>ALTER MATERIALIZED VIEW</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= ALTER MATERIALIZED VIEW <br>
WITH ( AND )*</p>
</div>
<div class="paragraph">
<p>The <code>ALTER MATERIALIZED VIEW</code> statement allows options to be update;
these options are the same as <code>CREATE TABLE</code>’s options.</p>
</div>
</div>
<div class="sect3">
<h4 id="dropMVStmt"><a class="anchor" href="#dropMVStmt"></a>DROP MATERIALIZED VIEW</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax). ::= DROP MATERIALIZED VIEW ( IF EXISTS )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample). DROP MATERIALIZED VIEW monkeySpecies_by_population;</p>
</div>
<div class="paragraph">
<p>The <code>DROP MATERIALIZED VIEW</code> statement is used to drop an existing
materialized view.</p>
</div>
<div class="paragraph">
<p>If the materialized view does not exists, the statement will return an
error, unless <code>IF EXISTS</code> is used in which case the operation is a
no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="createTypeStmt"><a class="anchor" href="#createTypeStmt"></a>CREATE TYPE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE TYPE ( IF NOT EXISTS )? <br>
`(' ( `,' )* `)'</p>
</div>
<div class="paragraph">
<p>::= ( `.' )?</p>
</div>
<div class="paragraph">
<p>::=</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE TYPE address (<br>
street_name text,<br>
street_number int,<br>
city text,<br>
state text,<br>
zip int<br>
)</p>
</div>
<div class="paragraph">
<p>CREATE TYPE work_and_home_addresses (<br>
home_address address,<br>
work_address address<br>
)<br>
p.<br>
The <code>CREATE TYPE</code> statement creates a new user-defined type. Each type
is a set of named, typed fields. Field types may be any valid type,
including collections and other existing user-defined types.</p>
</div>
<div class="paragraph">
<p>Attempting to create an already existing type will result in an error
unless the <code>IF NOT EXISTS</code> option is used. If it is used, the statement
will be a no-op if the type already exists.</p>
</div>
<div class="sect4">
<h5 id="createTypeName"><a class="anchor" href="#createTypeName"></a><code>&lt;typename&gt;</code></h5>
<div class="paragraph">
<p>Valid type names are identifiers. The names of existing CQL types and
<a href="#appendixB">reserved type names</a> may not be used.</p>
</div>
<div class="paragraph">
<p>If the type name is provided alone, the type is created with the current
keyspace (see <code>USE</code>). If it is prefixed by an existing keyspace name,
the type is created within the specified keyspace instead of the current
keyspace.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="alterTypeStmt"><a class="anchor" href="#alterTypeStmt"></a>ALTER TYPE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= ALTER TYPE (IF EXISTS)?</p>
</div>
<div class="paragraph">
<p>::= ADD (IF NOT EXISTS)? <br>
| RENAME (IF EXISTS)? TO ( AND TO )*<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
ALTER TYPE address ADD country text</p>
</div>
<div class="paragraph">
<p>ALTER TYPE address RENAME zip TO zipcode AND street_name TO street<br>
p.<br>
The <code>ALTER TYPE</code> statement is used to manipulate type definitions. It
allows for adding new fields, renaming existing fields, or changing the
type of existing fields. If the type does not exist, the statement will return an error, unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="dropTypeStmt"><a class="anchor" href="#dropTypeStmt"></a>DROP TYPE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP TYPE ( IF EXISTS )? <br>
p.<br>
The <code>DROP TYPE</code> statement results in the immediate, irreversible removal
of a type. Attempting to drop a type that is still in use by another
type or a table will result in an error.</p>
</div>
<div class="paragraph">
<p>If the type does not exist, an error will be returned unless <code>IF EXISTS</code>
is used, in which case the operation is a no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="createTriggerStmt"><a class="anchor" href="#createTriggerStmt"></a>CREATE TRIGGER</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE TRIGGER ( IF NOT EXISTS )? ( )?<br>
ON <br>
USING</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TRIGGER myTrigger ON myTable USING
`org.apache.cassandra.triggers.InvertedIndex';</p>
</div>
<div class="paragraph">
<p>The actual logic that makes up the trigger can be written in any Java
(JVM) language and exists outside the database. You place the trigger
code in a <code>lib/triggers</code> subdirectory of the Cassandra installation
directory, it loads during cluster startup, and exists on every node
that participates in a cluster. The trigger defined on a table fires
before a requested DML statement occurs, which ensures the atomicity of
the transaction.</p>
</div>
</div>
<div class="sect3">
<h4 id="dropTriggerStmt"><a class="anchor" href="#dropTriggerStmt"></a>DROP TRIGGER</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP TRIGGER ( IF EXISTS )? ( )?<br>
ON <br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DROP TRIGGER myTrigger ON myTable;</p>
</div>
<div class="paragraph">
<p><code>DROP TRIGGER</code> statement removes the registration of a trigger created
using <code>CREATE TRIGGER</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="createFunctionStmt"><a class="anchor" href="#createFunctionStmt"></a>CREATE FUNCTION</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE ( OR REPLACE )?<br>
FUNCTION ( IF NOT EXISTS )?<br>
( `.' )? <br>
`(' ( `,' )* `)'<br>
( CALLED | RETURNS NULL ) ON NULL INPUT<br>
RETURNS <br>
LANGUAGE <br>
AS</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE OR REPLACE FUNCTION somefunction<br>
( somearg int, anotherarg text, complexarg frozen, listarg list )<br>
RETURNS NULL ON NULL INPUT<br>
RETURNS text<br>
LANGUAGE java<br>
AS +
;<br>
CREATE FUNCTION akeyspace.fname IF NOT EXISTS<br>
( someArg int )<br>
CALLED ON NULL INPUT<br>
RETURNS text<br>
LANGUAGE java<br>
AS +
;</p>
</div>
<div class="paragraph">
<p><code>CREATE FUNCTION</code> creates or replaces a user-defined function.</p>
</div>
<div class="sect4">
<h5 id="functionSignature"><a class="anchor" href="#functionSignature"></a>Function Signature</h5>
<div class="paragraph">
<p>Signatures are used to distinguish individual functions. The signature
consists of:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>The fully qualified function name - i.e <em>keyspace</em> plus
<em>function-name</em></p>
</li>
<li>
<p>The concatenated list of all argument types</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>Note that keyspace names, function names and argument types are subject
to the default naming conventions and case-sensitivity rules.</p>
</div>
<div class="paragraph">
<p><code>CREATE FUNCTION</code> with the optional <code>OR REPLACE</code> keywords either creates
a function or replaces an existing one with the same signature. A
<code>CREATE FUNCTION</code> without <code>OR REPLACE</code> fails if a function with the same
signature already exists.</p>
</div>
<div class="paragraph">
<p>Behavior on invocation with <code>null</code> values must be defined for each
function. There are two options:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><code>RETURNS NULL ON NULL INPUT</code> declares that the function will always
return <code>null</code> if any of the input arguments is <code>null</code>.</p>
</li>
<li>
<p><code>CALLED ON NULL INPUT</code> declares that the function will always be
executed.</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>If the optional <code>IF NOT EXISTS</code> keywords are used, the function will
only be created if another function with the same signature does not
exist.</p>
</div>
<div class="paragraph">
<p><code>OR REPLACE</code> and <code>IF NOT EXIST</code> cannot be used together.</p>
</div>
<div class="paragraph">
<p>Functions belong to a keyspace. If no keyspace is specified in
<code>&lt;function-name&gt;</code>, the current keyspace is used (i.e. the keyspace
specified using the <a href="#useStmt"><code>USE</code></a> statement). It is not possible
to create a user-defined function in one of the system keyspaces.</p>
</div>
<div class="paragraph">
<p>See the section on <a href="#udfs">user-defined functions</a> for more
information.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="dropFunctionStmt"><a class="anchor" href="#dropFunctionStmt"></a>DROP FUNCTION</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP FUNCTION ( IF EXISTS )?<br>
( `.' )? <br>
( `(' ( `,' )* `)' )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DROP FUNCTION myfunction;<br>
DROP FUNCTION mykeyspace.afunction;<br>
DROP FUNCTION afunction ( int );<br>
DROP FUNCTION afunction ( text );</p>
</div>
<div class="paragraph">
<p><code>DROP FUNCTION</code> statement removes a function created using
<code>CREATE FUNCTION</code>.<br>
You must specify the argument types (<a href="#functionSignature">signature</a>
) of the function to drop if there are multiple functions with the same
name but a different signature (overloaded functions).</p>
</div>
<div class="paragraph">
<p><code>DROP FUNCTION</code> with the optional <code>IF EXISTS</code> keywords drops a function
if it exists.</p>
</div>
</div>
<div class="sect3">
<h4 id="createAggregateStmt"><a class="anchor" href="#createAggregateStmt"></a>CREATE AGGREGATE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE ( OR REPLACE )?<br>
AGGREGATE ( IF NOT EXISTS )?<br>
( `.' )? <br>
`(' ( `,' )* `)'<br>
SFUNC <br>
STYPE <br>
( FINALFUNC )?<br>
( INITCOND )?<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE AGGREGATE myaggregate ( val text )<br>
SFUNC myaggregate_state<br>
STYPE text<br>
FINALFUNC myaggregate_final<br>
INITCOND `foo';</p>
</div>
<div class="paragraph">
<p>See the section on <a href="#udas">user-defined aggregates</a> for a complete
example.</p>
</div>
<div class="paragraph">
<p><code>CREATE AGGREGATE</code> creates or replaces a user-defined aggregate.</p>
</div>
<div class="paragraph">
<p><code>CREATE AGGREGATE</code> with the optional <code>OR REPLACE</code> keywords either
creates an aggregate or replaces an existing one with the same
signature. A <code>CREATE AGGREGATE</code> without <code>OR REPLACE</code> fails if an
aggregate with the same signature already exists.</p>
</div>
<div class="paragraph">
<p><code>CREATE AGGREGATE</code> with the optional <code>IF NOT EXISTS</code> keywords either
creates an aggregate if it does not already exist.</p>
</div>
<div class="paragraph">
<p><code>OR REPLACE</code> and <code>IF NOT EXIST</code> cannot be used together.</p>
</div>
<div class="paragraph">
<p>Aggregates belong to a keyspace. If no keyspace is specified in
<code>&lt;aggregate-name&gt;</code>, the current keyspace is used (i.e. the keyspace
specified using the <a href="#useStmt"><code>USE</code></a> statement). It is not possible
to create a user-defined aggregate in one of the system keyspaces.</p>
</div>
<div class="paragraph">
<p>Signatures for user-defined aggregates follow the
<a href="#functionSignature">same rules</a> as for user-defined functions.</p>
</div>
<div class="paragraph">
<p><code>STYPE</code> defines the type of the state value and must be specified.</p>
</div>
<div class="paragraph">
<p>The optional <code>INITCOND</code> defines the initial state value for the
aggregate. It defaults to <code>null</code>. A non-<code>null</code> <code>INITCOND</code> must be
specified for state functions that are declared with
<code>RETURNS NULL ON NULL INPUT</code>.</p>
</div>
<div class="paragraph">
<p><code>SFUNC</code> references an existing function to be used as the state
modifying function. The type of first argument of the state function
must match <code>STYPE</code>. The remaining argument types of the state function
must match the argument types of the aggregate function. State is not
updated for state functions declared with <code>RETURNS NULL ON NULL INPUT</code>
and called with <code>null</code>.</p>
</div>
<div class="paragraph">
<p>The optional <code>FINALFUNC</code> is called just before the aggregate result is
returned. It must take only one argument with type <code>STYPE</code>. The return
type of the <code>FINALFUNC</code> may be a different type. A final function
declared with <code>RETURNS NULL ON NULL INPUT</code> means that the aggregate’s
return value will be <code>null</code>, if the last state is <code>null</code>.</p>
</div>
<div class="paragraph">
<p>If no <code>FINALFUNC</code> is defined, the overall return type of the aggregate
function is <code>STYPE</code>. If a <code>FINALFUNC</code> is defined, it is the return type
of that function.</p>
</div>
<div class="paragraph">
<p>See the section on <a href="#udas">user-defined aggregates</a> for more
information.</p>
</div>
</div>
<div class="sect3">
<h4 id="dropAggregateStmt"><a class="anchor" href="#dropAggregateStmt"></a>DROP AGGREGATE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP AGGREGATE ( IF EXISTS )?<br>
( `.' )? <br>
( `(' ( `,' )* `)' )?<br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DROP AGGREGATE myAggregate;<br>
DROP AGGREGATE myKeyspace.anAggregate;<br>
DROP AGGREGATE someAggregate ( int );<br>
DROP AGGREGATE someAggregate ( text );</p>
</div>
<div class="paragraph">
<p>The <code>DROP AGGREGATE</code> statement removes an aggregate created using
<code>CREATE AGGREGATE</code>. You must specify the argument types of the aggregate
to drop if there are multiple aggregates with the same name but a
different signature (overloaded aggregates).</p>
</div>
<div class="paragraph">
<p><code>DROP AGGREGATE</code> with the optional <code>IF EXISTS</code> keywords drops an
aggregate if it exists, and does nothing if a function with the
signature does not exist.</p>
</div>
<div class="paragraph">
<p>Signatures for user-defined aggregates follow the
<a href="#functionSignature">same rules</a> as for user-defined functions.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="dataManipulation"><a class="anchor" href="#dataManipulation"></a>Data Manipulation</h3>
<div class="sect3">
<h4 id="insertStmt"><a class="anchor" href="#insertStmt"></a>INSERT</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= INSERT INTO <br>
( ( VALUES )<br>
| ( JSON ))<br>
( IF NOT EXISTS )?<br>
( USING ( AND )* )?</p>
</div>
<div class="paragraph">
<p>::= `(' ( `,' )* `)'</p>
</div>
<div class="paragraph">
<p>::= `(' ( `,' )* `)'</p>
</div>
<div class="paragraph">
<p>::= TIMESTAMP <br>
| TTL <br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
INSERT INTO NerdMovies (movie, director, main_actor, year)<br>
VALUES (`Serenity', `Joss Whedon', `Nathan Fillion', 2005)<br>
USING TTL 86400;</p>
</div>
<div class="paragraph">
<p>INSERT INTO NerdMovies JSON <code>\{<code>movie'': </code>Serenity'', <code>director'':
</code>Joss Whedon'', ``year'': 2005}'<br>
p.<br>
The `INSERT</code> statement writes one or more columns for a given row in a
table. Note that since a row is identified by its <code>PRIMARY KEY</code>, at
least the columns composing it must be specified. The list of columns to
insert to must be supplied when using the <code>VALUES</code> syntax. When using
the <code>JSON</code> syntax, they are optional. See the section on
<a href="#insertJson"><code>INSERT JSON</code></a> for more details.</p>
</div>
<div class="paragraph">
<p>Note that unlike in SQL, <code>INSERT</code> does not check the prior existence of
the row by default: the row is created if none existed before, and
updated otherwise. Furthermore, there is no mean to know which of
creation or update happened.</p>
</div>
<div class="paragraph">
<p>It is however possible to use the <code>IF NOT EXISTS</code> condition to only
insert if the row does not exist prior to the insertion. But please note
that using <code>IF NOT EXISTS</code> will incur a non negligible performance cost
(internally, Paxos will be used) so this should be used sparingly.</p>
</div>
<div class="paragraph">
<p>All updates for an <code>INSERT</code> are applied atomically and in isolation.</p>
</div>
<div class="paragraph">
<p>Please refer to the <a href="#updateOptions"><code>UPDATE</code></a> section for
information on the <code>&lt;option&gt;</code> available and to the
<a href="#collections">collections</a> section for use of
<code>&lt;collection-literal&gt;</code>. Also note that <code>INSERT</code> does not support
counters, while <code>UPDATE</code> does.</p>
</div>
</div>
<div class="sect3">
<h4 id="updateStmt"><a class="anchor" href="#updateStmt"></a>UPDATE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= UPDATE <br>
( USING ( AND )* )?<br>
SET ( `,' )*<br>
WHERE <br>
( IF ( AND condition )* )?</p>
</div>
<div class="paragraph">
<p>::= <code>=' <br>
| `=' (</code>+' | `-') ( | | )<br>
| `=' `+' <br>
| `[' `]' `=' <br>
| `.' `='</p>
</div>
<div class="paragraph">
<p>::= <br>
| CONTAINS (KEY)?<br>
| IN <br>
| `[' `]' <br>
| `[' `]' IN <br>
| `.' <br>
| `.' IN</p>
</div>
<div class="paragraph">
<p>::= `&lt;' | `&#8656;' | `=' | `!=' | `&gt;=' | `&gt;'<br>
::= ( | `(' ( ( `,' )* )? `)')</p>
</div>
<div class="paragraph">
<p>::= ( AND )*</p>
</div>
<div class="paragraph">
<p>::= <code>=' <br>
| `(' (</code>,' )* <code>)' `=' <br>
| IN `(' ( ( `,' )* )? `)'<br>
| IN <br>
| `(' (</code>,' )* <code>)' IN `(' ( ( `,' )* )? `)'<br>
| `(' (</code>,' )* `)' IN</p>
</div>
<div class="paragraph">
<p>::= TIMESTAMP <br>
| TTL <br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
UPDATE NerdMovies USING TTL 400<br>
SET director = `Joss Whedon',<br>
main_actor = `Nathan Fillion',<br>
year = 2005<br>
WHERE movie = `Serenity';</p>
</div>
<div class="paragraph">
<p>UPDATE UserActions SET total = total + 2 WHERE user =
B70DE1D0-9908-4AE3-BE34-5573E5B09F14 AND action = <code>click';<br>
p.<br>
The `UPDATE</code> statement writes one or more columns for a given row in a
table. The <code>&lt;where-clause&gt;</code> is used to select the row to update and must
include all columns composing the <code>PRIMARY KEY</code>. Other columns values
are specified through <code>&lt;assignment&gt;</code> after the <code>SET</code> keyword.</p>
</div>
<div class="paragraph">
<p>Note that unlike in SQL, <code>UPDATE</code> does not check the prior existence of
the row by default (except through the use of <code>&lt;condition&gt;</code>, see below):
the row is created if none existed before, and updated otherwise.
Furthermore, there are no means to know whether a creation or update
occurred.</p>
</div>
<div class="paragraph">
<p>It is however possible to use the conditions on some columns through
<code>IF</code>, in which case the row will not be updated unless the conditions
are met. But, please note that using <code>IF</code> conditions will incur a
non-negligible performance cost (internally, Paxos will be used) so this
should be used sparingly.</p>
</div>
<div class="paragraph">
<p>In an <code>UPDATE</code> statement, all updates within the same partition key are
applied atomically and in isolation.</p>
</div>
<div class="paragraph">
<p>The <code>c = c + 3</code> form of <code>&lt;assignment&gt;</code> is used to increment/decrement
counters. The identifier after the `=' sign <strong>must</strong> be the same than the
one before the `=' sign (Only increment/decrement is supported on
counters, not the assignment of a specific value).</p>
</div>
<div class="paragraph">
<p>The <code>id = id + &lt;collection-literal&gt;</code> and <code>id[value1] = value2</code> forms of
<code>&lt;assignment&gt;</code> are for collections. Please refer to the
<a href="#collections">relevant section</a> for more details.</p>
</div>
<div class="paragraph">
<p>The <code>id.field = &lt;term&gt;</code> form of <code>&lt;assignemt&gt;</code> is for setting the value
of a single field on a non-frozen user-defined types.</p>
</div>
<div class="sect4">
<h5 id="updateOptions"><a class="anchor" href="#updateOptions"></a><code>&lt;options&gt;</code></h5>
<div class="paragraph">
<p>The <code>UPDATE</code> and <code>INSERT</code> statements support the following options:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>TIMESTAMP</code>: sets the timestamp for the operation. If not specified,
the coordinator will use the current time (in microseconds) at the start
of statement execution as the timestamp. This is usually a suitable
default.</p>
</li>
<li>
<p><code>TTL</code>: specifies an optional Time To Live (in seconds) for the
inserted values. If set, the inserted values are automatically removed
from the database after the specified time. Note that the TTL concerns
the inserted values, not the columns themselves. This means that any
subsequent update of the column will also reset the TTL (to whatever TTL
is specified in that update). By default, values never expire. A TTL of
0 is equivalent to no TTL. If the table has a default_time_to_live, a
TTL of 0 will remove the TTL for the inserted or updated values.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect3">
<h4 id="deleteStmt"><a class="anchor" href="#deleteStmt"></a>DELETE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DELETE ( ( `,' )* )?<br>
FROM <br>
( USING TIMESTAMP )?<br>
WHERE <br>
( IF ( EXISTS | ( ( AND )*) ) )?</p>
</div>
<div class="paragraph">
<p>::= <br>
| `[' `]'<br>
| `.'</p>
</div>
<div class="paragraph">
<p>::= ( AND )*</p>
</div>
<div class="paragraph">
<p>::= <br>
| <code>(' (</code>,' )* <code>)' <br>
| IN `(' ( ( `,' )* )? `)'<br>
| IN <br>
| `(' (</code>,' )* <code>)' IN `(' ( ( `,' )* )? `)'<br>
| `(' (</code>,' )* `)' IN</p>
</div>
<div class="paragraph">
<p>::= `=' | `&lt;' | `&gt;' | `&#8656;' | `&gt;='<br>
::= ( | `(' ( ( `,' )* )? `)')</p>
</div>
<div class="paragraph">
<p>::= ( | `!=') <br>
| CONTAINS (KEY)?<br>
| IN <br>
| `[' `]' ( | `!=') <br>
| `[' `]' IN <br>
| `.' ( | `!=') <br>
| `.' IN</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
DELETE FROM NerdMovies USING TIMESTAMP 1240003134 WHERE movie =
`Serenity';</p>
</div>
<div class="paragraph">
<p>DELETE phone FROM Users WHERE userid IN
(C73DE1D3-AF08-40F3-B124-3FF3E5109F22,
B70DE1D0-9908-4AE3-BE34-5573E5B09F14);<br>
p.<br>
The <code>DELETE</code> statement deletes columns and rows. If column names are
provided directly after the <code>DELETE</code> keyword, only those columns are
deleted from the row indicated by the <code>&lt;where-clause&gt;</code>. The <code>id[value]</code>
syntax in <code>&lt;selection&gt;</code> is for non-frozen collections (please refer to
the <a href="#collections">collection section</a> for more details). The
<code>id.field</code> syntax is for the deletion of non-frozen user-defined types.
Otherwise, whole rows are removed. The <code>&lt;where-clause&gt;</code> specifies which
rows are to be deleted. Multiple rows may be deleted with one statement
by using an <code>IN</code> clause. A range of rows may be deleted using an
inequality operator (such as <code>&gt;=</code>).</p>
</div>
<div class="paragraph">
<p><code>DELETE</code> supports the <code>TIMESTAMP</code> option with the same semantics as the
<a href="#updateStmt"><code>UPDATE</code></a> statement.</p>
</div>
<div class="paragraph">
<p>In a <code>DELETE</code> statement, all deletions within the same partition key are
applied atomically and in isolation.</p>
</div>
<div class="paragraph">
<p>A <code>DELETE</code> operation can be conditional through the use of an <code>IF</code>
clause, similar to <code>UPDATE</code> and <code>INSERT</code> statements. However, as with
<code>INSERT</code> and <code>UPDATE</code> statements, this will incur a non-negligible
performance cost (internally, Paxos will be used) and so should be used
sparingly.</p>
</div>
</div>
<div class="sect3">
<h4 id="batchStmt"><a class="anchor" href="#batchStmt"></a>BATCH</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= BEGIN ( UNLOGGED | COUNTER ) BATCH<br>
( USING ( AND )* )?<br>
( `;' )*<br>
APPLY BATCH</p>
</div>
<div class="paragraph">
<p>::= <br>
| <br>
|</p>
</div>
<div class="paragraph">
<p>::= TIMESTAMP <br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
BEGIN BATCH<br>
INSERT INTO users (userid, password, name) VALUES (`user2', `ch@ngem3b',
`second user');<br>
UPDATE users SET password = `ps22dhds' WHERE userid = `user3';<br>
INSERT INTO users (userid, password) VALUES (`user4', `ch@ngem3c');<br>
DELETE name FROM users WHERE userid = `user1';<br>
APPLY BATCH;</p>
</div>
<div class="paragraph">
<p>The <code>BATCH</code> statement group multiple modification statements
(insertions/updates and deletions) into a single statement. It serves
several purposes:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>It saves network round-trips between the client and the server (and
sometimes between the server coordinator and the replicas) when batching
multiple updates.</p>
</li>
<li>
<p>All updates in a <code>BATCH</code> belonging to a given partition key are
performed in isolation.</p>
</li>
<li>
<p>By default, all operations in the batch are performed as <code>LOGGED</code>, to
ensure all mutations eventually complete (or none will). See the notes
on <a href="#unloggedBatch"><code>UNLOGGED</code></a> for more details.</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>Note that:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>BATCH</code> statements may only contain <code>UPDATE</code>, <code>INSERT</code> and <code>DELETE</code>
statements.</p>
</li>
<li>
<p>Batches are <em>not</em> a full analogue for SQL transactions.</p>
</li>
<li>
<p>If a timestamp is not specified for each operation, then all
operations will be applied with the same timestamp. Due to Cassandra’s
conflict resolution procedure in the case of
<a href="http://wiki.apache.org/cassandra/FAQ#clocktie">timestamp ties</a>,
operations may be applied in an order that is different from the order
they are listed in the <code>BATCH</code> statement. To force a particular
operation ordering, you must specify per-operation timestamps.</p>
</li>
</ul>
</div>
<div class="sect4">
<h5 id="unloggedBatch"><a class="anchor" href="#unloggedBatch"></a><code>UNLOGGED</code></h5>
<div class="paragraph">
<p>By default, Cassandra uses a batch log to ensure all operations in a
batch eventually complete or none will (note however that operations are
only isolated within a single partition).</p>
</div>
<div class="paragraph">
<p>There is a performance penalty for batch atomicity when a batch spans
multiple partitions. If you do not want to incur this penalty, you can
tell Cassandra to skip the batchlog with the <code>UNLOGGED</code> option. If the
<code>UNLOGGED</code> option is used, a failed batch might leave the patch only
partly applied.</p>
</div>
</div>
<div class="sect4">
<h5 id="counterBatch"><a class="anchor" href="#counterBatch"></a><code>COUNTER</code></h5>
<div class="paragraph">
<p>Use the <code>COUNTER</code> option for batched counter updates. Unlike other
updates in Cassandra, counter updates are not idempotent.</p>
</div>
</div>
<div class="sect4">
<h5 id="batchOptions"><a class="anchor" href="#batchOptions"></a><code>&lt;option&gt;</code></h5>
<div class="paragraph">
<p><code>BATCH</code> supports both the <code>TIMESTAMP</code> option, with similar semantic to
the one described in the <a href="#updateOptions"><code>UPDATE</code></a> statement (the
timestamp applies to all the statement inside the batch). However, if
used, <code>TIMESTAMP</code> <strong>must not</strong> be used in the statements within the batch.</p>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="queries"><a class="anchor" href="#queries"></a>Queries</h3>
<div class="sect3">
<h4 id="selectStmt"><a class="anchor" href="#selectStmt"></a>SELECT</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= SELECT ( JSON )? <br>
FROM <br>
( WHERE )?<br>
( GROUP BY )?<br>
( ORDER BY )?<br>
( PER PARTITION LIMIT )?<br>
( LIMIT )?<br>
( ALLOW FILTERING )?</p>
</div>
<div class="paragraph">
<p>::= DISTINCT?</p>
</div>
<div class="paragraph">
<p>::= (AS )? ( `,' (AS )? )*<br>
| `*'</p>
</div>
<div class="paragraph">
<p>::= <br>
| <br>
| WRITETIME <code>(' `)'<br>
| MAXWRITETIME `(' `)'<br>
| COUNT `(' `<strong>' `)'<br>
| TTL `(' `)'<br>
| CAST `(' AS `)'<br>
| `(' ( (</code>,' )</strong>)? `)'<br>
| `.' <br>
| `[' `]'<br>
| `[' ? .. ? `]'</p>
</div>
<div class="paragraph">
<p>::= ( AND )*</p>
</div>
<div class="paragraph">
<p>::= <br>
| <code>(' (</code>,' )* <code>)' <br>
| IN `(' ( ( `,' )* )? `)'<br>
| `(' (</code>,' )* `)' IN `(' ( ( `,' )* )? `)'<br>
| TOKEN `(' ( `,' )* `)'</p>
</div>
<div class="paragraph">
<p>::= <code>=' | `&lt;' | `&gt;' | `&#8656;' | `&gt;=' | CONTAINS | CONTAINS KEY<br>
::= (</code>,' )*<br>
::= ( <code>,' )*<br>
::= ( ASC | DESC )?<br>
::= `(' (</code>,' )* `)'<br>
p.<br>
<em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
SELECT name, occupation FROM users WHERE userid IN (199, 200, 207);</p>
</div>
<div class="paragraph">
<p>SELECT JSON name, occupation FROM users WHERE userid = 199;</p>
</div>
<div class="paragraph">
<p>SELECT name AS user_name, occupation AS user_occupation FROM users;</p>
</div>
<div class="paragraph">
<p>SELECT time, value<br>
FROM events<br>
WHERE event_type = `myEvent'<br>
AND time &gt; `2011-02-03'<br>
AND time &#8656; `2012-01-01'</p>
</div>
<div class="paragraph">
<p>SELECT COUNT (*) FROM users;</p>
</div>
<div class="paragraph">
<p>SELECT COUNT (*) AS user_count FROM users;</p>
</div>
<div class="paragraph">
<p>The <code>SELECT</code> statements reads one or more columns for one or more rows
in a table. It returns a result-set of rows, where each row contains the
collection of columns corresponding to the query. If the <code>JSON</code> keyword
is used, the results for each row will contain only a single column
named <code>`json''. See the section on <a href="#selectJson">`SELECT JSON</code></a> for
more details.</p>
</div>
<div class="sect4">
<h5 id="selectSelection"><a class="anchor" href="#selectSelection"></a><code>&lt;select-clause&gt;</code></h5>
<div class="paragraph">
<p>The <code>&lt;select-clause&gt;</code> determines which columns needs to be queried and
returned in the result-set. It consists of either the comma-separated
list of or the wildcard character (<code>*</code>) to select all the columns
defined for the table. Please note that for wildcard <code>SELECT</code> queries
the order of columns returned is not specified and is not guaranteed to
be stable between Cassandra versions.</p>
</div>
<div class="paragraph">
<p>A <code>&lt;selector&gt;</code> is either a column name to retrieve or a <code>&lt;function&gt;</code> of
one or more <code>&lt;term&gt;`s. The function allowed are the same as for `&lt;term&gt;</code>
and are described in the <a href="#functions">function section</a>. In addition
to these generic functions, the <code>WRITETIME</code> and <code>MAXWRITETIME</code> (resp. <code>TTL</code>)
function allows to select the timestamp of when the column was inserted (resp.
the time to live (in seconds) for the column (or null if the column has
no expiration set)) and the <a href="#castFun"><code>CAST</code></a> function can be used
to convert one data type to another. The <code>WRITETIME</code> and <code>TTL</code> functions
can&#8217;t be used on multi-cell columns such as non-frozen collections or
non-frozen user-defined types.</p>
</div>
<div class="paragraph">
<p>Additionally, individual values of maps and sets can be selected using
<code>[ &lt;term&gt; ]</code>. For maps, this will return the value corresponding to the
key, if such entry exists. For sets, this will return the key that is
selected if it exists and is thus mainly a way to check element
existence. It is also possible to select a slice of a set or map with
`[ &lt;term&gt; &#8230;&#8203; &lt;term&gt; `], where both bound can be omitted.</p>
</div>
<div class="paragraph">
<p>Any <code>&lt;selector&gt;</code> can be aliased using <code>AS</code> keyword (see examples).
Please note that <code>&lt;where-clause&gt;</code> and <code>&lt;order-by&gt;</code> clause should refer
to the columns by their original names and not by their aliases.</p>
</div>
<div class="paragraph">
<p>The <code>COUNT</code> keyword can be used with parenthesis enclosing <code>*</code>. If so,
the query will return a single result: the number of rows matching the
query. Note that <code>COUNT(1)</code> is supported as an alias.</p>
</div>
</div>
<div class="sect4">
<h5 id="selectWhere"><a class="anchor" href="#selectWhere"></a><code>&lt;where-clause&gt;</code></h5>
<div class="paragraph">
<p>The <code>&lt;where-clause&gt;</code> specifies which rows must be queried. It is
composed of relations on the columns that are part of the <code>PRIMARY KEY</code>
and/or have a <a href="#createIndexStmt">secondary index</a> defined on them.</p>
</div>
<div class="paragraph">
<p>Not all relations are allowed in a query. For instance, non-equal
relations (where <code>IN</code> is considered as an equal relation) on a partition
key are not supported (but see the use of the <code>TOKEN</code> method below to do
non-equal queries on the partition key). Moreover, for a given partition
key, the clustering columns induce an ordering of rows and relations on
them is restricted to the relations that allow to select a <strong>contiguous</strong>
(for the ordering) set of rows. For instance, given</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE posts (<br>
userid text,<br>
blog_title text,<br>
posted_at timestamp,<br>
entry_title text,<br>
content text,<br>
category int,<br>
PRIMARY KEY (userid, blog_title, posted_at)<br>
)</p>
</div>
<div class="paragraph">
<p>The following query is allowed:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT entry_title, content FROM posts WHERE userid=`john doe' AND
blog_title=`John'`s Blog' AND posted_at &gt;= `2012-01-01' AND posted_at &lt;
`2012-01-31'</p>
</div>
<div class="paragraph">
<p>But the following one is not, as it does not select a contiguous set of
rows (and we suppose no secondary indexes are set):</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT entry_title, content FROM posts WHERE userid=`john doe' AND
posted_at &gt;= `2012-01-01' AND posted_at &lt; `2012-01-31'</p>
</div>
<div class="paragraph">
<p>When specifying relations, the <code>TOKEN</code> function can be used on the
<code>PARTITION KEY</code> column to query. In that case, rows will be selected
based on the token of their <code>PARTITION_KEY</code> rather than on the value.
Note that the token of a key depends on the partitioner in use, and that
in particular the RandomPartitioner won’t yield a meaningful order. Also
note that ordering partitioners always order token values by bytes (so
even if the partition key is of type int, <code>token(-1) &gt; token(0)</code> in
particular). Example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM posts WHERE token(userid) &gt; token(`tom') AND token(userid)
&lt; token(`bob')</p>
</div>
<div class="paragraph">
<p>Moreover, the <code>IN</code> relation is only allowed on the last column of the
partition key and on the last column of the full primary key.</p>
</div>
<div class="paragraph">
<p>It is also possible to <code>`group'' `CLUSTERING COLUMNS</code> together in a
relation using the tuple notation. For instance:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM posts WHERE userid=`john doe' AND (blog_title, posted_at)
&gt; (`John'`s Blog', `2012-01-01')</p>
</div>
<div class="paragraph">
<p>will request all rows that sorts after the one having <code>`John’s Blog'' as
`blog_tile</code> and <code>2012-01-01' for `posted_at</code> in the clustering order. In
particular, rows having a <code>post_at &#8656; '2012-01-01'</code> will be returned as
long as their <code>blog_title &gt; 'John''s Blog'</code>, which wouldn’t be the case
for:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM posts WHERE userid=`john doe' AND blog_title &gt; `John'`s
Blog' AND posted_at &gt; `2012-01-01'</p>
</div>
<div class="paragraph">
<p>The tuple notation may also be used for <code>IN</code> clauses on
<code>CLUSTERING COLUMNS</code>:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM posts WHERE userid=`john doe' AND (blog_title, posted_at)
IN `John'`s Blog', `2012-01-01), (’Extreme Chess', `2014-06-01'</p>
</div>
<div class="paragraph">
<p>The <code>CONTAINS</code> operator may only be used on collection columns (lists,
sets, and maps). In the case of maps, <code>CONTAINS</code> applies to the map
values. The <code>CONTAINS KEY</code> operator may only be used on map columns and
applies to the map keys.</p>
</div>
</div>
<div class="sect4">
<h5 id="selectOrderBy"><a class="anchor" href="#selectOrderBy"></a><code>&lt;order-by&gt;</code></h5>
<div class="paragraph">
<p>The <code>ORDER BY</code> option allows to select the order of the returned
results. It takes as argument a list of column names along with the
order for the column (<code>ASC</code> for ascendant and <code>DESC</code> for descendant,
omitting the order being equivalent to <code>ASC</code>). Currently the possible
orderings are limited (which depends on the table
<a href="#createTableOptions"><code>CLUSTERING ORDER</code></a> ):</p>
</div>
<div class="ulist">
<ul>
<li>
<p>if the table has been defined without any specific <code>CLUSTERING ORDER</code>,
then then allowed orderings are the order induced by the clustering
columns and the reverse of that one.</p>
</li>
<li>
<p>otherwise, the orderings allowed are the order of the
<code>CLUSTERING ORDER</code> option and the reversed one.</p>
</li>
</ul>
</div>
</div>
<div class="sect4">
<h5 id="selectGroupBy"><a class="anchor" href="#selectGroupBy"></a><code>&lt;group-by&gt;</code></h5>
<div class="paragraph">
<p>The <code>GROUP BY</code> option allows to condense into a single row all selected
rows that share the same values for a set of columns.</p>
</div>
<div class="paragraph">
<p>Using the <code>GROUP BY</code> option, it is only possible to group rows at the
partition key level or at a clustering column level. By consequence, the
<code>GROUP BY</code> option only accept as arguments primary key column names in
the primary key order. If a primary key column is restricted by an
equality restriction it is not required to be present in the <code>GROUP BY</code>
clause.</p>
</div>
<div class="paragraph">
<p>Aggregate functions will produce a separate value for each group. If no
<code>GROUP BY</code> clause is specified, aggregates functions will produce a
single value for all the rows.</p>
</div>
<div class="paragraph">
<p>If a column is selected without an aggregate function, in a statement
with a <code>GROUP BY</code>, the first value encounter in each group will be
returned.</p>
</div>
</div>
<div class="sect4">
<h5 id="selectLimit"><a class="anchor" href="#selectLimit"></a><code>LIMIT</code> and <code>PER PARTITION LIMIT</code></h5>
<div class="paragraph">
<p>The <code>LIMIT</code> option to a <code>SELECT</code> statement limits the number of rows
returned by a query, while the <code>PER PARTITION LIMIT</code> option limits the
number of rows returned for a given partition by the query. Note that
both type of limit can used in the same statement.</p>
</div>
</div>
<div class="sect4">
<h5 id="selectAllowFiltering"><a class="anchor" href="#selectAllowFiltering"></a><code>ALLOW FILTERING</code></h5>
<div class="paragraph">
<p>By default, CQL only allows select queries that don’t involve
<code>filtering'' server side, i.e. queries where we know that all (live)
record read will be returned (maybe partly) in the result set. The
reasoning is that those </code>non filtering'' queries have predictable
performance in the sense that they will execute in a time that is
proportional to the amount of data <strong>returned</strong> by the query (which can be
controlled through <code>LIMIT</code>).</p>
</div>
<div class="paragraph">
<p>The <code>ALLOW FILTERING</code> option allows to explicitly allow (some) queries
that require filtering. Please note that a query using <code>ALLOW FILTERING</code>
may thus have unpredictable performance (for the definition above), i.e.
even a query that selects a handful of records <strong>may</strong> exhibit performance
that depends on the total amount of data stored in the cluster.</p>
</div>
<div class="paragraph">
<p>For instance, considering the following table holding user profiles with
their year of birth (with a secondary index on it) and country of
residence:</p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE TABLE users (<br>
username text PRIMARY KEY,<br>
firstname text,<br>
lastname text,<br>
birth_year int,<br>
country text<br>
)</p>
</div>
<div class="paragraph">
<p>CREATE INDEX ON users(birth_year);<br>
p.</p>
</div>
<div class="paragraph">
<p>Then the following queries are valid:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM users;<br>
SELECT firstname, lastname FROM users WHERE birth_year = 1981;</p>
</div>
<div class="paragraph">
<p>because in both case, Cassandra guarantees that these queries
performance will be proportional to the amount of data returned. In
particular, if no users are born in 1981, then the second query
performance will not depend of the number of user profile stored in the
database (not directly at least: due to secondary index implementation
consideration, this query may still depend on the number of node in the
cluster, which indirectly depends on the amount of data stored.
Nevertheless, the number of nodes will always be multiple number of
magnitude lower than the number of user profile stored). Of course, both
query may return very large result set in practice, but the amount of
data returned can always be controlled by adding a <code>LIMIT</code>.</p>
</div>
<div class="paragraph">
<p>However, the following query will be rejected:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT firstname, lastname FROM users WHERE birth_year = 1981 AND
country = `FR';</p>
</div>
<div class="paragraph">
<p>because Cassandra cannot guarantee that it won’t have to scan large
amount of data even if the result to those query is small. Typically, it
will scan all the index entries for users born in 1981 even if only a
handful are actually from France. However, if you <code>`know what you are
doing'', you can force the execution of this query by using
`ALLOW FILTERING</code> and so the following query is valid:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT firstname, lastname FROM users WHERE birth_year = 1981 AND
country = `FR' ALLOW FILTERING;</p>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="databaseRoles"><a class="anchor" href="#databaseRoles"></a>Database Roles</h3>
<div class="sect3">
<h4 id="createRoleStmt"><a class="anchor" href="#createRoleStmt"></a>CREATE ROLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE ROLE ( IF NOT EXISTS )? ( WITH ( AND )* )?</p>
</div>
<div class="paragraph">
<p>::= PASSWORD = <br>
| LOGIN = <br>
| SUPERUSER = <br>
| OPTIONS = <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE ROLE new_role;<br>
CREATE ROLE alice WITH PASSWORD = `password_a' AND LOGIN = true;<br>
CREATE ROLE bob WITH PASSWORD = `password_b' AND LOGIN = true AND
SUPERUSER = true;<br>
CREATE ROLE carlos WITH OPTIONS = \{ `custom_option1' : `option1_value',
`custom_option2' : 99 };</p>
</div>
<div class="paragraph">
<p>By default roles do not possess <code>LOGIN</code> privileges or <code>SUPERUSER</code>
status.</p>
</div>
<div class="paragraph">
<p><a href="#permissions">Permissions</a> on database resources are granted to
roles; types of resources include keyspaces, tables, functions and roles
themselves. Roles may be granted to other roles to create hierarchical
permissions structures; in these hierarchies, permissions and
<code>SUPERUSER</code> status are inherited, but the <code>LOGIN</code> privilege is not.</p>
</div>
<div class="paragraph">
<p>If a role has the <code>LOGIN</code> privilege, clients may identify as that role
when connecting. For the duration of that connection, the client will
acquire any roles and privileges granted to that role.</p>
</div>
<div class="paragraph">
<p>Only a client with with the <code>CREATE</code> permission on the database roles
resource may issue <code>CREATE ROLE</code> requests (see the
<a href="#permissions">relevant section</a> below), unless the client is a
<code>SUPERUSER</code>. Role management in Cassandra is pluggable and custom
implementations may support only a subset of the listed options.</p>
</div>
<div class="paragraph">
<p>Role names should be quoted if they contain non-alphanumeric characters.</p>
</div>
<div class="sect4">
<h5 id="createRolePwd"><a class="anchor" href="#createRolePwd"></a>Setting credentials for internal authentication</h5>
<div class="paragraph">
<p>Use the <code>WITH PASSWORD</code> clause to set a password for internal
authentication, enclosing the password in single quotation marks.<br>
If internal authentication has not been set up or the role does not have
<code>LOGIN</code> privileges, the <code>WITH PASSWORD</code> clause is not necessary.</p>
</div>
</div>
<div class="sect4">
<h5 id="createRoleConditional"><a class="anchor" href="#createRoleConditional"></a>Creating a role conditionally</h5>
<div class="paragraph">
<p>Attempting to create an existing role results in an invalid query
condition unless the <code>IF NOT EXISTS</code> option is used. If the option is
used and the role exists, the statement is a no-op.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE ROLE other_role;<br>
CREATE ROLE IF NOT EXISTS other_role;</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="alterRoleStmt"><a class="anchor" href="#alterRoleStmt"></a>ALTER ROLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= ALTER ROLE (IF EXISTS)? ( WITH ( AND )* )?</p>
</div>
<div class="paragraph">
<p>::= PASSWORD = <br>
| LOGIN = <br>
| SUPERUSER = <br>
| OPTIONS = <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
ALTER ROLE bob WITH PASSWORD = `PASSWORD_B' AND SUPERUSER = false;</p>
</div>
<div class="paragraph">
<p>If the role does not exist, the statement will return an error, unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
<div class="paragraph">
<p>Conditions on executing <code>ALTER ROLE</code> statements:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>A client must have <code>SUPERUSER</code> status to alter the <code>SUPERUSER</code> status
of another role</p>
</li>
<li>
<p>A client cannot alter the <code>SUPERUSER</code> status of any role it currently
holds</p>
</li>
<li>
<p>A client can only modify certain properties of the role with which it
identified at login (e.g. <code>PASSWORD</code>)</p>
</li>
<li>
<p>To modify properties of a role, the client must be granted <code>ALTER</code>
<a href="#permissions">permission</a> on that role</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="dropRoleStmt"><a class="anchor" href="#dropRoleStmt"></a>DROP ROLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP ROLE ( IF EXISTS )? <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DROP ROLE alice;<br>
DROP ROLE IF EXISTS bob;</p>
</div>
<div class="paragraph">
<p><code>DROP ROLE</code> requires the client to have <code>DROP</code>
<a href="#permissions">permission</a> on the role in question. In addition,
client may not <code>DROP</code> the role with which it identified at login.
Finaly, only a client with <code>SUPERUSER</code> status may <code>DROP</code> another
<code>SUPERUSER</code> role.<br>
Attempting to drop a role which does not exist results in an invalid
query condition unless the <code>IF EXISTS</code> option is used. If the option is
used and the role does not exist the statement is a no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="grantRoleStmt"><a class="anchor" href="#grantRoleStmt"></a>GRANT ROLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax).<br>
::= GRANT TO</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT report_writer TO alice;</p>
</div>
<div class="paragraph">
<p>This statement grants the <code>report_writer</code> role to <code>alice</code>. Any
permissions granted to <code>report_writer</code> are also acquired by <code>alice</code>.<br>
Roles are modelled as a directed acyclic graph, so circular grants are
not permitted. The following examples result in error conditions:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT role_a TO role_b;<br>
GRANT role_b TO role_a;</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT role_a TO role_b;<br>
GRANT role_b TO role_c;<br>
GRANT role_c TO role_a;</p>
</div>
</div>
<div class="sect3">
<h4 id="revokeRoleStmt"><a class="anchor" href="#revokeRoleStmt"></a>REVOKE ROLE</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax).<br>
::= REVOKE FROM</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
REVOKE report_writer FROM alice;</p>
</div>
<div class="paragraph">
<p>This statement revokes the <code>report_writer</code> role from <code>alice</code>. Any
permissions that <code>alice</code> has acquired via the <code>report_writer</code> role are
also revoked.</p>
</div>
<div class="sect4">
<h5 id="listRolesStmt"><a class="anchor" href="#listRolesStmt"></a>LIST ROLES</h5>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax).<br>
::= LIST ROLES ( OF )? ( NORECURSIVE )?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST ROLES;</p>
</div>
<div class="paragraph">
<p>Return all known roles in the system, this requires <code>DESCRIBE</code>
permission on the database roles resource.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST ROLES OF <code>alice</code>;</p>
</div>
<div class="paragraph">
<p>Enumerate all roles granted to <code>alice</code>, including those transitively
aquired.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST ROLES OF <code>bob</code> NORECURSIVE</p>
</div>
<div class="paragraph">
<p>List all roles directly granted to <code>bob</code>.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="createUserStmt"><a class="anchor" href="#createUserStmt"></a>CREATE USER</h4>
<div class="paragraph">
<p>Prior to the introduction of roles in Cassandra 2.2, authentication and
authorization were based around the concept of a <code>USER</code>. For backward
compatibility, the legacy syntax has been preserved with <code>USER</code> centric
statments becoming synonyms for the <code>ROLE</code> based equivalents.</p>
</div>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= CREATE USER ( IF NOT EXISTS )? ( WITH PASSWORD )? ()?</p>
</div>
<div class="paragraph">
<p>::= SUPERUSER<br>
| NOSUPERUSER<br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE USER alice WITH PASSWORD `password_a' SUPERUSER;<br>
CREATE USER bob WITH PASSWORD `password_b' NOSUPERUSER;</p>
</div>
<div class="paragraph">
<p><code>CREATE USER</code> is equivalent to <code>CREATE ROLE</code> where the <code>LOGIN</code> option is
<code>true</code>. So, the following pairs of statements are equivalent:</p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE USER alice WITH PASSWORD `password_a' SUPERUSER;<br>
CREATE ROLE alice WITH PASSWORD = `password_a' AND LOGIN = true AND
SUPERUSER = true;</p>
</div>
<div class="paragraph">
<p>CREATE USER IF NOT EXISTS alice WITH PASSWORD `password_a' SUPERUSER;<br>
CREATE ROLE IF NOT EXISTS alice WITH PASSWORD = `password_a' AND LOGIN =
true AND SUPERUSER = true;</p>
</div>
<div class="paragraph">
<p>CREATE USER alice WITH PASSWORD `password_a' NOSUPERUSER;<br>
CREATE ROLE alice WITH PASSWORD = `password_a' AND LOGIN = true AND
SUPERUSER = false;</p>
</div>
<div class="paragraph">
<p>CREATE USER alice WITH PASSWORD `password_a' NOSUPERUSER;<br>
CREATE ROLE alice WITH PASSWORD = `password_a' AND LOGIN = true;</p>
</div>
<div class="paragraph">
<p>CREATE USER alice WITH PASSWORD `password_a';<br>
CREATE ROLE alice WITH PASSWORD = `password_a' AND LOGIN = true;<br>
p.</p>
</div>
</div>
<div class="sect3">
<h4 id="alterUserStmt"><a class="anchor" href="#alterUserStmt"></a>ALTER USER</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= ALTER USER (IF EXISTS)? ( WITH PASSWORD )? ( )?</p>
</div>
<div class="paragraph">
<p>::= SUPERUSER<br>
| NOSUPERUSER<br>
p.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
ALTER USER alice WITH PASSWORD `PASSWORD_A';<br>
ALTER USER bob SUPERUSER;</p>
</div>
<div class="paragraph">
<p>If the user does not exist, the statement will return an error, unless <code>IF EXISTS</code> is used in which case the operation is a no-op.</p>
</div>
</div>
<div class="sect3">
<h4 id="dropUserStmt"><a class="anchor" href="#dropUserStmt"></a>DROP USER</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP USER ( IF EXISTS )? <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DROP USER alice;<br>
DROP USER IF EXISTS bob;</p>
</div>
</div>
<div class="sect3">
<h4 id="listUsersStmt"><a class="anchor" href="#listUsersStmt"></a>LIST USERS</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax).<br>
::= LIST USERS;</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST USERS;</p>
</div>
<div class="paragraph">
<p>This statement is equivalent to</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST ROLES;</p>
</div>
<div class="paragraph">
<p>but only roles with the <code>LOGIN</code> privilege are included in the output.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="databaseIdentity"><a class="anchor" href="#databaseIdentity"></a>Database Identities</h3>
<div class="sect3">
<h4 id="AddIdentityStmt"><a class="anchor" href="#AddIdentityStmt"></a>ADD IDENTITY</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= ADD IDENTITY ( IF NOT EXISTS )? TO ROLE ?</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
ADD IDENTITY 'id1' TO ROLE 'role1';</p>
</div>
<div class="paragraph">
<p>Only a user with privileges to add roles can add identities</p>
</div>
<div class="paragraph">
<p>Role names &amp; Identity names should be quoted if they contain non-alphanumeric characters.</p>
</div>
<div class="sect4">
<h5 id="addIdentityConditional"><a class="anchor" href="#addIdentityConditional"></a>Adding an identity conditionally</h5>
<div class="paragraph">
<p>Attempting to add an existing identity results in an invalid query
condition unless the <code>IF NOT EXISTS</code> option is used. If the option is
used and the identity exists, the statement is a no-op.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
ADD IDENTITY IF NOT EXISTS 'id1' TO ROLE 'role1';</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="dropIdentityStmt"><a class="anchor" href="#dropIdentityStmt"></a>DROP IDENTITY</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= DROP IDENTITY ( IF EXISTS )? <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DROP IDENTITY 'testIdentity';<br>
DROP IDENTITY IF EXISTS 'testIdentity';</p>
</div>
<div class="paragraph">
<p>Only a user with privileges to drop roles can remove identities</p>
</div>
<div class="paragraph">
<p>Attempting to drop an Identity which does not exist results in an invalid
query condition unless the <code>IF EXISTS</code> option is used. If the option is
used and the identity does not exist the statement is a no-op.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="dataControl"><a class="anchor" href="#dataControl"></a>Data Control</h3>
<div class="sect3">
<h4 id="permissions"><a class="anchor" href="#permissions"></a>Permissions</h4>
<div class="paragraph">
<p>Permissions on resources are granted to roles; there are several
different types of resources in Cassandra and each type is modelled
hierarchically:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>The hierarchy of Data resources, Keyspaces and Tables has the
structure <code>ALL KEYSPACES</code> &#8594; <code>KEYSPACE</code> &#8594; <code>TABLE</code></p>
</li>
<li>
<p>Function resources have the structure <code>ALL FUNCTIONS</code> &#8594; <code>KEYSPACE</code> &#8594;
<code>FUNCTION</code></p>
</li>
<li>
<p>Resources representing roles have the structure <code>ALL ROLES</code> &#8594; <code>ROLE</code></p>
</li>
<li>
<p>Resources representing JMX ObjectNames, which map to sets of
MBeans/MXBeans, have the structure <code>ALL MBEANS</code> &#8594; <code>MBEAN</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Permissions can be granted at any level of these hierarchies and they
flow downwards. So granting a permission on a resource higher up the
chain automatically grants that same permission on all resources lower
down. For example, granting <code>SELECT</code> on a <code>KEYSPACE</code> automatically
grants it on all <code>TABLES</code> in that <code>KEYSPACE</code>. Likewise, granting a
permission on <code>ALL FUNCTIONS</code> grants it on every defined function,
regardless of which keyspace it is scoped in. It is also possible to
grant permissions on all functions scoped to a particular keyspace.</p>
</div>
<div class="paragraph">
<p>Modifications to permissions are visible to existing client sessions;
that is, connections need not be re-established following permissions
changes.</p>
</div>
<div class="paragraph">
<p>The full set of available permissions is:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>CREATE</code></p>
</li>
<li>
<p><code>ALTER</code></p>
</li>
<li>
<p><code>DROP</code></p>
</li>
<li>
<p><code>SELECT</code></p>
</li>
<li>
<p><code>MODIFY</code></p>
</li>
<li>
<p><code>AUTHORIZE</code></p>
</li>
<li>
<p><code>DESCRIBE</code></p>
</li>
<li>
<p><code>EXECUTE</code></p>
</li>
<li>
<p><code>UNMASK</code></p>
</li>
<li>
<p><code>SELECT_MASKED</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Not all permissions are applicable to every type of resource. For
instance, <code>EXECUTE</code> is only relevant in the context of functions or
mbeans; granting <code>EXECUTE</code> on a resource representing a table is
nonsensical. Attempting to <code>GRANT</code> a permission on resource to which it
cannot be applied results in an error response. The following
illustrates which permissions can be granted on which types of resource,
and which statements are enabled by that permission.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.6666%;">
<col style="width: 16.667%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">permission</th>
<th class="tableblock halign-left valign-top">resource</th>
<th class="tableblock halign-left valign-top">operations</th>
<th class="tableblock halign-left valign-top"></th>
<th class="tableblock halign-left valign-top"></th>
<th class="tableblock halign-left valign-top"></th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE KEYSPACE</code> &lt;br&gt; <code>CREATE TABLE</code> in any
keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE TABLE</code> in specified keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE FUNCTION</code> in any keyspace &lt;br&gt;
<code>CREATE AGGREGATE</code> in any keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS IN KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE FUNCTION</code> in keyspace
&lt;br&gt; <code>CREATE AGGREGATE</code> in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE ROLE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER KEYSPACE</code> &lt;br&gt; <code>ALTER TABLE</code> in any
keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER KEYSPACE</code> &lt;br&gt; <code>ALTER TABLE</code> in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER TABLE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE FUNCTION</code> replacing any existing &lt;br&gt;
<code>CREATE AGGREGATE</code> replacing any existing</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS IN KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE FUNCTION</code> replacing
existing in keyspace &lt;br&gt; <code>CREATE AGGREGATE</code> replacing any existing in
keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FUNCTION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE FUNCTION</code> replacing existing &lt;br&gt;
<code>CREATE AGGREGATE</code> replacing existing</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER ROLE</code> on any role</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ROLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER ROLE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP KEYSPACE</code> &lt;br&gt; <code>DROP TABLE</code> in any
keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP TABLE</code> in specified keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP TABLE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP FUNCTION</code> in any keyspace &lt;br&gt;
<code>DROP AGGREGATE</code> in any existing</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS IN KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP FUNCTION</code> in keyspace &lt;br&gt;
<code>DROP AGGREGATE</code> in existing</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FUNCTION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP FUNCTION</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP ROLE</code> on any role</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ROLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP ROLE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code> on any table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code> on any table in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code> on specified table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Call getter methods on any mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Call getter methods on any mbean matching a
wildcard pattern</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Call getter methods on named mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INSERT</code> on any table &lt;br&gt; <code>UPDATE</code> on any
table &lt;br&gt; <code>DELETE</code> on any table &lt;br&gt; <code>TRUNCATE</code> on any table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INSERT</code> on any table in keyspace &lt;br&gt; <code>UPDATE</code>
on any table in keyspace &lt;br&gt; <code>DELETE</code> on any table in keyspace &lt;br&gt;
<code>TRUNCATE</code> on any table in keyspace</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INSERT</code> &lt;br&gt;
<code>UPDATE</code> &lt;br&gt; <code>DELETE</code> &lt;br&gt; <code>TRUNCATE</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Call setter methods on any mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Call setter methods on any mbean matching a
wildcard pattern</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Call setter methods on named mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> on any table &lt;br&gt;
<code>REVOKE PERMISSION</code> on any table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> on table in keyspace &lt;br&gt;
<code>REVOKE PERMISSION</code> on table in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> &lt;br&gt; <code>REVOKE PERMISSION</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> on any function &lt;br&gt;
<code>REVOKE PERMISSION</code> on any function</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS IN KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> in
keyspace &lt;br&gt; <code>REVOKE PERMISSION</code> in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS IN KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> in
keyspace &lt;br&gt; <code>REVOKE PERMISSION</code> in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FUNCTION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> &lt;br&gt; <code>REVOKE PERMISSION</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> on any mbean &lt;br&gt;
<code>REVOKE PERMISSION</code> on any mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> on any mbean matching a
wildcard pattern &lt;br&gt; <code>REVOKE PERMISSION</code> on any mbean matching a
wildcard pattern</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT PERMISSION</code> on named mbean &lt;br&gt;
<code>REVOKE PERMISSION</code> on named mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT ROLE</code> grant any role &lt;br&gt;
<code>REVOKE ROLE</code> revoke any role</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT ROLE</code> grant role &lt;br&gt; <code>REVOKE ROLE</code> revoke
role</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DESCRIBE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LIST ROLES</code> all roles or only roles granted
to another, specified role</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DESCRIBE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">@ALL MBEANS</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Retrieve metadata about any mbean from the
platform’s MBeanServer</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DESCRIBE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">@MBEANS</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Retrieve metadata about any mbean matching a
wildcard patter from the platform’s MBeanServer</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DESCRIBE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">@MBEAN</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Retrieve metadata about a named mbean from the
platform’s MBeanServer</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code>, <code>INSERT</code>, <code>UPDATE</code> using any
function &lt;br&gt; use of any function in <code>CREATE AGGREGATE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL FUNCTIONS IN KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code>, <code>INSERT</code>, <code>UPDATE</code>
using any function in keyspace &lt;br&gt; use of any function in keyspace in
<code>CREATE AGGREGATE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FUNCTION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code>, <code>INSERT</code>, <code>UPDATE</code> using function &lt;br&gt;
use of function in <code>CREATE AGGREGATE</code></p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Execute operations on any mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Execute operations on any mbean matching a
wildcard pattern</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Execute operations on named mbean</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UNMASK</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">See the clear contents of masked columns on any table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UNMASK</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">See the clear contents of masked columns on any table in keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UNMASK</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">See the clear contents of masked columns on the specified table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT_MASKED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code> restricting masked columns on any table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT_MASKED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code> restricting masked columns on any table in specified keyspace</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT_MASKED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code> restricting masked columns on the specified table</p></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="grantPermissionsStmt"><a class="anchor" href="#grantPermissionsStmt"></a>GRANT PERMISSION</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= GRANT ( ALL ( PERMISSIONS )? | ( PERMISSION )? ) ON TO</p>
</div>
<div class="paragraph">
<p>::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESCRIBE | UNMASK | SELECT_MASKED
EXECUTE</p>
</div>
<div class="paragraph">
<p>::= ALL KEYSPACES<br>
| KEYSPACE <br>
| ( TABLE )? <br>
| ALL ROLES<br>
| ROLE <br>
| ALL FUNCTIONS ( IN KEYSPACE )?<br>
| FUNCTION <br>
| ALL MBEANS<br>
| ( MBEAN | MBEANS ) <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT SELECT ON ALL KEYSPACES TO data_reader;</p>
</div>
<div class="paragraph">
<p>This gives any user with the role <code>data_reader</code> permission to execute
<code>SELECT</code> statements on any table across all keyspaces</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT MODIFY ON KEYSPACE keyspace1 TO data_writer;</p>
</div>
<div class="paragraph">
<p>This give any user with the role <code>data_writer</code> permission to perform
<code>UPDATE</code>, <code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code> and <code>TRUNCATE</code> queries on all
tables in the <code>keyspace1</code> keyspace</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT DROP ON keyspace1.table1 TO schema_owner;</p>
</div>
<div class="paragraph">
<p>This gives any user with the <code>schema_owner</code> role permissions to <code>DROP</code>
<code>keyspace1.table1</code>.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT EXECUTE ON FUNCTION keyspace1.user_function( int ) TO
report_writer;</p>
</div>
<div class="paragraph">
<p>This grants any user with the <code>report_writer</code> role permission to execute
<code>SELECT</code>, <code>INSERT</code> and <code>UPDATE</code> queries which use the function
<code>keyspace1.user_function( int )</code></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
GRANT DESCRIBE ON ALL ROLES TO role_admin;</p>
</div>
<div class="paragraph">
<p>This grants any user with the <code>role_admin</code> role permission to view any
and all roles in the system with a <code>LIST ROLES</code> statement</p>
</div>
<div class="sect4">
<h5 id="grantAll"><a class="anchor" href="#grantAll"></a>GRANT ALL</h5>
<div class="paragraph">
<p>When the <code>GRANT ALL</code> form is used, the appropriate set of permissions is
determined automatically based on the target resource.</p>
</div>
</div>
<div class="sect4">
<h5 id="autoGrantPermissions"><a class="anchor" href="#autoGrantPermissions"></a>Automatic Granting</h5>
<div class="paragraph">
<p>When a resource is created, via a <code>CREATE KEYSPACE</code>, <code>CREATE TABLE</code>,
<code>CREATE FUNCTION</code>, <code>CREATE AGGREGATE</code> or <code>CREATE ROLE</code> statement, the
creator (the role the database user who issues the statement is
identified as), is automatically granted all applicable permissions on
the new resource.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="revokePermissionsStmt"><a class="anchor" href="#revokePermissionsStmt"></a>REVOKE PERMISSION</h4>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= REVOKE ( ALL ( PERMISSIONS )? | ( PERMISSION )? ) ON FROM</p>
</div>
<div class="paragraph">
<p>::= CREATE | ALTER | DROP | SELECT | MODIFY | AUTHORIZE | DESCRIBE | UNMASK | SELECT_MASKED
EXECUTE</p>
</div>
<div class="paragraph">
<p>::= ALL KEYSPACES<br>
| KEYSPACE <br>
| ( TABLE )? <br>
| ALL ROLES<br>
| ROLE <br>
| ALL FUNCTIONS ( IN KEYSPACE )?<br>
| FUNCTION <br>
| ALL MBEANS<br>
| ( MBEAN | MBEANS ) <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
REVOKE SELECT ON ALL KEYSPACES FROM data_reader;<br>
REVOKE MODIFY ON KEYSPACE keyspace1 FROM data_writer;<br>
REVOKE DROP ON keyspace1.table1 FROM schema_owner;<br>
REVOKE EXECUTE ON FUNCTION keyspace1.user_function( int ) FROM
report_writer;<br>
REVOKE DESCRIBE ON ALL ROLES FROM role_admin;<br>
p.</p>
</div>
<div class="sect4">
<h5 id="listPermissionsStmt"><a class="anchor" href="#listPermissionsStmt"></a>LIST PERMISSIONS</h5>
<div class="paragraph">
<p><em>Syntax:</em></p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= LIST ( ALL ( PERMISSIONS )? | )<br>
( ON )?<br>
( OF ( NORECURSIVE )? )?</p>
</div>
<div class="paragraph">
<p>::= ALL KEYSPACES<br>
| KEYSPACE <br>
| ( TABLE )? <br>
| ALL ROLES<br>
| ROLE <br>
| ALL FUNCTIONS ( IN KEYSPACE )?<br>
| FUNCTION <br>
| ALL MBEANS<br>
| ( MBEAN | MBEANS ) <br>
p.</p>
</div>
<div class="paragraph">
<p><em>Sample:</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST ALL PERMISSIONS OF alice;</p>
</div>
<div class="paragraph">
<p>Show all permissions granted to <code>alice</code>, including those acquired
transitively from any other roles.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST ALL PERMISSIONS ON keyspace1.table1 OF bob;</p>
</div>
<div class="paragraph">
<p>Show all permissions on <code>keyspace1.table1</code> granted to <code>bob</code>, including
those acquired transitively from any other roles. This also includes any
permissions higher up the resource hierarchy which can be applied to
<code>keyspace1.table1</code>. For example, should <code>bob</code> have <code>ALTER</code> permission on
<code>keyspace1</code>, that would be included in the results of this query. Adding
the <code>NORECURSIVE</code> switch restricts the results to only those permissions
which were directly granted to <code>bob</code> or one of <code>bob</code>’s roles.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
LIST SELECT PERMISSIONS OF carlos;</p>
</div>
<div class="paragraph">
<p>Show any permissions granted to <code>carlos</code> or any of <code>carlos</code>’s roles,
limited to <code>SELECT</code> permissions on any resource.</p>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="types"><a class="anchor" href="#types"></a>Data Types</h3>
<div class="paragraph">
<p>CQL supports a rich set of data types for columns defined in a table,
including collection types. On top of those native<br>
and collection types, users can also provide custom types (through a
JAVA class extending <code>AbstractType</code> loadable by<br>
Cassandra). The syntax of types is thus:</p>
</div>
<div class="paragraph">
<p>bc(syntax)..<br>
::= <br>
| <br>
| <br>
| // Used for custom types. The fully-qualified name of a JAVA class</p>
</div>
<div class="paragraph">
<p>::= ascii<br>
| bigint<br>
| blob<br>
| boolean<br>
| counter<br>
| date<br>
| decimal<br>
| double<br>
| float<br>
| inet<br>
| int<br>
| smallint<br>
| text<br>
| time<br>
| timestamp<br>
| timeuuid<br>
| tinyint<br>
| uuid<br>
| varchar<br>
| varint</p>
</div>
<div class="paragraph">
<p>::= list <code>&lt;' `&gt;'<br>
| set `&lt;' `&gt;'<br>
| map `&lt;' `,' `&gt;'<br>
::= tuple `&lt;' (</code>,' )* `&gt;'<br>
p. Note that the native types are keywords and as such are
case-insensitive. They are however not reserved ones.</p>
</div>
<div class="paragraph">
<p>The following table gives additional informations on the native data
types, and on which kind of <a href="#constants">constants</a> each type
supports:</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">type</th>
<th class="tableblock halign-left valign-top">constants supported</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ascii</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ASCII character string</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bigint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">64-bit signed long</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>blob</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">blobs</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Arbitrary bytes (no validation)</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">booleans</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true or false</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>counter</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Counter column (64-bit signed value). See
<a href="#counters">Counters</a> for details</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers, strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A date (with no corresponding time value).
See <a href="#usingdates">Working with dates</a> below for more information.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>decimal</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers, floats</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Variable-precision decimal</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>double</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">64-bit IEEE-754 floating point</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>float</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers, floats</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">32-bit IEEE-754 floating point</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>inet</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">An IP address. It can be either 4 bytes long (IPv4) or
16 bytes long (IPv6). There is no <code>inet</code> constant, IP address should be
inputed as strings</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>int</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">32-bit signed int</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>smallint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">16-bit signed int</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">UTF8 encoded string</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>time</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers, strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A time with nanosecond precision. See
<a href="#usingtime">Working with time</a> below for more information.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers, strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A timestamp. Strings constant are allow
to input timestamps as dates, see <a href="#usingtimestamps">Working with
timestamps</a> below for more information.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeuuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">uuids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Type 1 UUID. This is generally used as a
``conflict-free'' timestamp. Also see the <a href="#timeuuidFun">functions on
Timeuuid</a></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">8-bit signed int</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>uuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">uuids</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Type 1 or type 4 UUID</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>varchar</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">strings</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">UTF8 encoded string</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>varint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integers</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Arbitrary-precision integer</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>For more information on how to use the collection types, see the
<a href="#collections">Working with collections</a> section below.</p>
</div>
<div class="sect3">
<h4 id="usingtimestamps"><a class="anchor" href="#usingtimestamps"></a>Working with timestamps</h4>
<div class="paragraph">
<p>Values of the <code>timestamp</code> type are encoded as 64-bit signed integers
representing a number of milliseconds since the standard base time known
as ``the epoch'': January 1 1970 at 00:00:00 GMT.</p>
</div>
<div class="paragraph">
<p>Timestamp can be input in CQL as simple long integers, giving the number
of milliseconds since the epoch, as defined above.</p>
</div>
<div class="paragraph">
<p>They can also be input as string literals in any of the following ISO
8601 formats, each representing the time and date Mar 2, 2011, at
04:05:00 AM, GMT.:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>2011-02-03 04:05+0000</code></p>
</li>
<li>
<p><code>2011-02-03 04:05:00+0000</code></p>
</li>
<li>
<p><code>2011-02-03 04:05:00.000+0000</code></p>
</li>
<li>
<p><code>2011-02-03T04:05+0000</code></p>
</li>
<li>
<p><code>2011-02-03T04:05:00+0000</code></p>
</li>
<li>
<p><code>2011-02-03T04:05:00.000+0000</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The <code>+0000</code> above is an RFC 822 4-digit time zone specification; <code>+0000</code>
refers to GMT. US Pacific Standard Time is <code>-0800</code>. The time zone may be
omitted if desired— the date will be interpreted as being in the time
zone under which the coordinating Cassandra node is configured.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>2011-02-03 04:05</code></p>
</li>
<li>
<p><code>2011-02-03 04:05:00</code></p>
</li>
<li>
<p><code>2011-02-03 04:05:00.000</code></p>
</li>
<li>
<p><code>2011-02-03T04:05</code></p>
</li>
<li>
<p><code>2011-02-03T04:05:00</code></p>
</li>
<li>
<p><code>2011-02-03T04:05:00.000</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>There are clear difficulties inherent in relying on the time zone
configuration being as expected, though, so it is recommended that the
time zone always be specified for timestamps when feasible.</p>
</div>
<div class="paragraph">
<p>The time of day may also be omitted, if the date is the only piece that
matters:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>2011-02-03</code></p>
</li>
<li>
<p><code>2011-02-03+0000</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>In that case, the time of day will default to 00:00:00, in the specified
or default time zone.</p>
</div>
</div>
<div class="sect3">
<h4 id="usingdates"><a class="anchor" href="#usingdates"></a>Working with dates</h4>
<div class="paragraph">
<p>Values of the <code>date</code> type are encoded as 32-bit unsigned integers
representing a number of days with ``the epoch'' at the center of the
range (2^31). Epoch is January 1st, 1970</p>
</div>
<div class="paragraph">
<p>A date can be input in CQL as an unsigned integer as defined above.</p>
</div>
<div class="paragraph">
<p>They can also be input as string literals in the following format:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>2014-01-01</code></p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="usingtime"><a class="anchor" href="#usingtime"></a>Working with time</h4>
<div class="paragraph">
<p>Values of the <code>time</code> type are encoded as 64-bit signed integers
representing the number of nanoseconds since midnight.</p>
</div>
<div class="paragraph">
<p>A time can be input in CQL as simple long integers, giving the number of
nanoseconds since midnight.</p>
</div>
<div class="paragraph">
<p>They can also be input as string literals in any of the following
formats:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>08:12:54</code></p>
</li>
<li>
<p><code>08:12:54.123</code></p>
</li>
<li>
<p><code>08:12:54.123456</code></p>
</li>
<li>
<p><code>08:12:54.123456789</code></p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="counters"><a class="anchor" href="#counters"></a>Counters</h4>
<div class="paragraph">
<p>The <code>counter</code> type is used to define <em>counter columns</em>. A counter column
is a column whose value is a 64-bit signed integer and on which 2
operations are supported: incrementation and decrementation (see
<a href="#updateStmt"><code>UPDATE</code></a> for syntax). Note the value of a counter
cannot be set. A counter doesn’t exist until first
incremented/decremented, and the first incrementation/decrementation is
made as if the previous value was 0. Deletion of counter columns is
supported but have some limitations (see the
<a href="http://wiki.apache.org/cassandra/Counters">Cassandra Wiki</a> for more
information).</p>
</div>
<div class="paragraph">
<p>The use of the counter type is limited in the following way:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>It cannot be used for column that is part of the <code>PRIMARY KEY</code> of a
table.</p>
</li>
<li>
<p>A table that contains a counter can only contain counters. In other
words, either all the columns of a table outside the <code>PRIMARY KEY</code> have
the counter type, or none of them have it.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="collections"><a class="anchor" href="#collections"></a>Working with collections</h4>
<div class="sect4">
<h5 id="noteworthy-characteristics"><a class="anchor" href="#noteworthy-characteristics"></a>Noteworthy characteristics</h5>
<div class="paragraph">
<p>Collections are meant for storing/denormalizing relatively small amount
of data. They work well for things like <code>the phone numbers of a given
user'', </code>labels applied to an email'', etc. But when items are expected
to grow unbounded (<code>all the messages sent by a given user'', </code>events
registered by a sensor'', …), then collections are not appropriate
anymore and a specific table (with clustering columns) should be used.
Concretely, collections have the following limitations:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Collections are always read in their entirety (and reading one is not
paged internally).</p>
</li>
<li>
<p>Collections cannot have more than 65535 elements. More precisely,
while it may be possible to insert more than 65535 elements, it is not
possible to read more than the 65535 first elements (see
<a href="https://issues.apache.org/jira/browse/CASSANDRA-5428">CASSANDRA-5428</a> for
details).</p>
</li>
<li>
<p>While insertion operations on sets and maps never incur a
read-before-write internally, some operations on lists do (see the
section on lists below for details). It is thus advised to prefer sets
over lists when possible.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>Please note that while some of those limitations may or may not be
loosen in the future, the general rule that collections are for
denormalizing small amount of data is meant to stay.</p>
</div>
</div>
<div class="sect4">
<h5 id="map"><a class="anchor" href="#map"></a>Maps</h5>
<div class="paragraph">
<p>A <code>map</code> is a <a href="#types">typed</a> set of key-value pairs, where keys are
unique. Furthermore, note that the map are internally sorted by their
keys and will thus always be returned in that order. To create a column
of type <code>map</code>, use the <code>map</code> keyword suffixed with comma-separated key
and value types, enclosed in angle brackets. For example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE users (<br>
id text PRIMARY KEY,<br>
given text,<br>
surname text,<br>
favs map&lt;text, text&gt; // A map of text keys, and text values<br>
)</p>
</div>
<div class="paragraph">
<p>Writing <code>map</code> data is accomplished with a JSON-inspired syntax. To write
a record using <code>INSERT</code>, specify the entire map as a JSON-style
associative array. <em>Note: This form will always replace the entire map.</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
INSERT INTO users (id, given, surname, favs)<br>
VALUES (`jsmith', `John', `Smith', \{ `fruit' : `apple', `band' :
`Beatles' })</p>
</div>
<div class="paragraph">
<p>Adding or updating key-values of a (potentially) existing map can be
accomplished either by subscripting the map column in an <code>UPDATE</code>
statement or by adding a new map literal:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
UPDATE users SET favs[`author'] = `Ed Poe' WHERE id = `jsmith'<br>
UPDATE users SET favs = favs + \{ `movie' : `Cassablanca' } WHERE id =
`jsmith'</p>
</div>
<div class="paragraph">
<p>Note that TTLs are allowed for both <code>INSERT</code> and <code>UPDATE</code>, but in both
case the TTL set only apply to the newly inserted/updated <em>values</em>. In
other words,</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
UPDATE users USING TTL 10 SET favs[`color'] = `green' WHERE id =
`jsmith'</p>
</div>
<div class="paragraph">
<p>will only apply the TTL to the <code>{ 'color' : 'green' }</code> record, the rest
of the map remaining unaffected.</p>
</div>
<div class="paragraph">
<p>Deleting a map record is done with:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
DELETE favs[`author'] FROM users WHERE id = `jsmith'</p>
</div>
</div>
<div class="sect4">
<h5 id="set"><a class="anchor" href="#set"></a>Sets</h5>
<div class="paragraph">
<p>A <code>set</code> is a <a href="#types">typed</a> collection of unique values. Sets are
ordered by their values. To create a column of type <code>set</code>, use the <code>set</code>
keyword suffixed with the value type enclosed in angle brackets. For
example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE images (<br>
name text PRIMARY KEY,<br>
owner text,<br>
date timestamp,<br>
tags set<br>
);</p>
</div>
<div class="paragraph">
<p>Writing a <code>set</code> is accomplished by comma separating the set values, and
enclosing them in curly braces. <em>Note: An <code>INSERT</code> will always replace
the entire set.</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
INSERT INTO images (name, owner, date, tags)<br>
VALUES (`cat.jpg', `jsmith', `now', \{ `kitten', `cat', `pet' });</p>
</div>
<div class="paragraph">
<p>Adding and removing values of a set can be accomplished with an <code>UPDATE</code>
by adding/removing new set values to an existing <code>set</code> column.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
UPDATE images SET tags = tags + \{ `cute', `cuddly' } WHERE name =
`cat.jpg';<br>
UPDATE images SET tags = tags - \{ `lame' } WHERE name = `cat.jpg';</p>
</div>
<div class="paragraph">
<p>As with <a href="#map">maps</a>, TTLs if used only apply to the newly
inserted/updated <em>values</em>.</p>
</div>
</div>
<div class="sect4">
<h5 id="list"><a class="anchor" href="#list"></a>Lists</h5>
<div class="paragraph">
<p>A <code>list</code> is a <a href="#types">typed</a> collection of non-unique values where
elements are ordered by there position in the list. To create a column
of type <code>list</code>, use the <code>list</code> keyword suffixed with the value type
enclosed in angle brackets. For example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE plays (<br>
id text PRIMARY KEY,<br>
game text,<br>
players int,<br>
scores list<br>
)</p>
</div>
<div class="paragraph">
<p>Do note that as explained below, lists have some limitations and
performance considerations to take into account, and it is advised to
prefer <a href="#set">sets</a> over lists when this is possible.</p>
</div>
<div class="paragraph">
<p>Writing <code>list</code> data is accomplished with a JSON-style syntax. To write a
record using <code>INSERT</code>, specify the entire list as a JSON array. <em>Note:
An <code>INSERT</code> will always replace the entire list.</em></p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
INSERT INTO plays (id, game, players, scores)<br>
VALUES (`123-afde', `quake', 3, [17, 4, 2]);</p>
</div>
<div class="paragraph">
<p>Adding (appending or prepending) values to a list can be accomplished by
adding a new JSON-style array to an existing <code>list</code> column.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
UPDATE plays SET players = 5, scores = scores + [ 14, 21 ] WHERE id =
`123-afde';<br>
UPDATE plays SET players = 5, scores = [ 12 ] + scores WHERE id =
`123-afde';</p>
</div>
<div class="paragraph">
<p>It should be noted that append and prepend are not idempotent
operations. This means that if during an append or a prepend the
operation timeout, it is not always safe to retry the operation (as this
could result in the record appended or prepended twice).</p>
</div>
<div class="paragraph">
<p>Lists also provides the following operation: setting an element by its
position in the list, removing an element by its position in the list
and remove all the occurrence of a given value in the list. <em>However,
and contrarily to all the other collection operations, these three
operations induce an internal read before the update, and will thus
typically have slower performance characteristics</em>. Those operations
have the following syntax:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
UPDATE plays SET scores[1] = 7 WHERE id = `123-afde'; // sets the 2nd
element of scores to 7 (raises an error is scores has less than 2
elements)<br>
DELETE scores[1] FROM plays WHERE id = `123-afde'; // deletes the 2nd
element of scores (raises an error is scores has less than 2 elements)<br>
UPDATE plays SET scores = scores - [ 12, 21 ] WHERE id = `123-afde'; //
removes all occurrences of 12 and 21 from scores</p>
</div>
<div class="paragraph">
<p>As with <a href="#map">maps</a>, TTLs if used only apply to the newly
inserted/updated <em>values</em>.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="vectors"><a class="anchor" href="#vectors"></a>Working with vectors</h4>
<div class="paragraph">
<p>Vectors are fixed-size sequences of non-null values of a certain data type. They use the same literals as lists.</p>
</div>
<div class="paragraph">
<p>You can define, insert and update a vector with:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-cql hljs" data-lang="cql">CREATE TABLE plays (
id text PRIMARY KEY,
game text,
players int,
scores vector&lt;int, 3&gt; // A vector of 3 integers
)
INSERT INTO plays (id, game, players, scores)
VALUES ('123-afde', 'quake', 3, [17, 4, 2]);
// Replace the existing vector entirely
UPDATE plays SET scores = [ 3, 9, 4] WHERE id = '123-afde';</code></pre>
</div>
</div>
<div class="paragraph">
<p>Note that it isn&#8217;t possible to change the individual values of a vector, and it isn&#8217;t possible to select individual
elements of a vector.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="functions"><a class="anchor" href="#functions"></a>Functions</h3>
<div class="paragraph">
<p>CQL3 distinguishes between built-in functions (so called `native
functions') and <a href="#udfs">user-defined functions</a>. CQL3 includes
several native functions, described below:</p>
</div>
<div class="sect3">
<h4 id="castFun"><a class="anchor" href="#castFun"></a>Cast</h4>
<div class="paragraph">
<p>The <code>cast</code> function can be used to converts one native datatype to
another.</p>
</div>
<div class="paragraph">
<p>The following table describes the conversions supported by the <code>cast</code>
function. Cassandra will silently ignore any cast converting a datatype
into its own datatype.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">from</th>
<th class="tableblock halign-left valign-top">to</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ascii</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bigint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>float</code>, <code>double</code>, <code>decimal</code>,
<code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>counter</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>bigint</code>, <code>float</code>, <code>double</code>,
<code>decimal</code>, <code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>decimal</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>bigint</code>, <code>float</code>, <code>double</code>,
<code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>double</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>bigint</code>, <code>float</code>, <code>decimal</code>,
<code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>float</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>bigint</code>, <code>double</code>, <code>decimal</code>,
<code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>inet</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>int</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>bigint</code>, <code>float</code>, <code>double</code>, <code>decimal</code>,
<code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>smallint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>int</code>, <code>bigint</code>, <code>float</code>, <code>double</code>, <code>decimal</code>,
<code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>time</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeuuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code>, <code>date</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>bigint</code>, <code>float</code>, <code>double</code>,
<code>decimal</code>, <code>varint</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>uuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code>, <code>varchar</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>varint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code>, <code>smallint</code>, <code>int</code>, <code>bigint</code>, <code>float</code>, <code>double</code>,
<code>decimal</code>, <code>text</code>, <code>varchar</code></p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>The conversions rely strictly on Java’s semantics. For example, the
double value 1 will be converted to the text value `1.0'.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT avg(cast(count as double)) FROM myTable</p>
</div>
</div>
<div class="sect3">
<h4 id="tokenFun"><a class="anchor" href="#tokenFun"></a>Token</h4>
<div class="paragraph">
<p>The <code>token</code> function allows to compute the token for a given partition
key. The exact signature of the token function depends on the table
concerned and of the partitioner used by the cluster.</p>
</div>
<div class="paragraph">
<p>The type of the arguments of the <code>token</code> depend on the type of the
partition key columns. The return type depend on the partitioner in use:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>For Murmur3Partitioner, the return type is <code>bigint</code>.</p>
</li>
<li>
<p>For RandomPartitioner, the return type is <code>varint</code>.</p>
</li>
<li>
<p>For ByteOrderedPartitioner, the return type is <code>blob</code>.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>For instance, in a cluster using the default Murmur3Partitioner, if a
table is defined by</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TABLE users (<br>
userid text PRIMARY KEY,<br>
username text,<br>
<br>
)</p>
</div>
<div class="paragraph">
<p>then the <code>token</code> function will take a single argument of type <code>text</code> (in
that case, the partition key is <code>userid</code> (there is no clustering columns
so the partition key is the same than the primary key)), and the return
type will be <code>bigint</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="uuidFun"><a class="anchor" href="#uuidFun"></a>Uuid</h4>
<div class="paragraph">
<p>The <code>uuid</code> function takes no parameters and generates a random type 4
uuid suitable for use in INSERT or SET statements.</p>
</div>
</div>
<div class="sect3">
<h4 id="timeuuidFun"><a class="anchor" href="#timeuuidFun"></a>Timeuuid functions</h4>
<div class="sect4">
<h5 id="now"><a class="anchor" href="#now"></a><code>now</code></h5>
<div class="paragraph">
<p>The <code>now</code> function takes no arguments and generates, on the coordinator
node, a new unique timeuuid (at the time where the statement using it is
executed). Note that this method is useful for insertion but is largely
non-sensical in <code>WHERE</code> clauses. For instance, a query of the form</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM myTable WHERE t = now()</p>
</div>
<div class="paragraph">
<p>will never return any result by design, since the value returned by
<code>now()</code> is guaranteed to be unique.</p>
</div>
</div>
<div class="sect4">
<h5 id="min_timeuuid-and-max_timeuuid"><a class="anchor" href="#min_timeuuid-and-max_timeuuid"></a><code>min_timeuuid</code> and <code>max_timeuuid</code></h5>
<div class="paragraph">
<p>The <code>min_timeuuid</code> (resp. <code>max_timeuuid</code>) function takes a <code>timestamp</code>
value <code>t</code> (which can be <a href="#usingtimestamps">either a timestamp or a
date string</a> ) and return a <em>fake</em> <code>timeuuid</code> corresponding to the
<em>smallest</em> (resp. <em>biggest</em>) possible <code>timeuuid</code> having for timestamp
<code>t</code>. So for instance:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT * FROM myTable WHERE t &gt; max_timeuuid(`2013-01-01 00:05+0000') AND
t &lt; min_timeuuid(`2013-02-02 10:00+0000')</p>
</div>
<div class="paragraph">
<p>will select all rows where the <code>timeuuid</code> column <code>t</code> is strictly older
than <code>2013-01-01 00:05+0000' but strictly younger than `2013-02-02
10:00+0000'. Please note that
`t &gt;= max_timeuuid('2013-01-01 00:05+0000')</code> would still <em>not</em> select a
<code>timeuuid</code> generated exactly at <code>2013-01-01 00:05+0000' and is
essentially equivalent to `t &gt; max_timeuuid('2013-01-01 00:05+0000')</code>.</p>
</div>
<div class="paragraph">
<p><em>Warning</em>: We called the values generated by <code>min_timeuuid</code> and
<code>max_timeuuid</code> <em>fake</em> UUID because they do no respect the Time-Based UUID
generation process specified by the
<a href="http://www.ietf.org/rfc/rfc4122.txt">RFC 4122</a>. In particular, the value
returned by these 2 methods will not be unique. This means you should
only use those methods for querying (as in the example above). Inserting
the result of those methods is almost certainly <em>a bad idea</em>.</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="timeFun"><a class="anchor" href="#timeFun"></a>Time conversion functions</h4>
<div class="paragraph">
<p>A number of functions are provided to <code>`convert'' a `timeuuid</code>, a
<code>timestamp</code> or a <code>date</code> into another <code>native</code> type.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">function name</th>
<th class="tableblock halign-left valign-top">input type</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeuuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>timeuuid</code> argument into a <code>date</code>
type</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>timestamp</code> argument into a <code>date</code>
type</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeuuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>timeuuid</code> argument into a
<code>timestamp</code> type</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>date</code> argument into a <code>timestamp</code>
type</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_unix_timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeuuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>timeuuid</code> argument into a
<code>bigInt</code> raw value</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_unix_timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>timestamp</code> argument into
a <code>bigInt</code> raw value</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>to_unix_timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Converts the <code>date</code> argument into a <code>bigInt</code>
raw value</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="blobFun"><a class="anchor" href="#blobFun"></a>Blob conversion functions</h4>
<div class="paragraph">
<p>A number of functions are provided to <code>`convert'' the native types into
binary data (`blob</code>). For every <code>&lt;native-type&gt;</code> <code>type</code> supported by CQL3
(a notable exceptions is <code>blob</code>, for obvious reasons), the function
<code>type_as_blob</code> takes a argument of type <code>type</code> and return it as a <code>blob</code>.
Conversely, the function <code>blob_as_type</code> takes a 64-bit <code>blob</code> argument and
convert it to a <code>bigint</code> value. And so for instance, <code>bigint_as_blob(3)</code>
is <code>0x0000000000000003</code> and <code>blob_as_bigint(0x0000000000000003)</code> is <code>3</code>.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="aggregates"><a class="anchor" href="#aggregates"></a>Aggregates</h3>
<div class="paragraph">
<p>Aggregate functions work on a set of rows. They receive values for each
row and returns one value for the whole set.<br>
If <code>normal</code> columns, <code>scalar functions</code>, <code>UDT</code> fields, <code>writetime</code>, <code>maxwritetime</code>
or <code>ttl</code> are selected together with aggregate functions, the values
returned for them will be the ones of the first row matching the query.</p>
</div>
<div class="paragraph">
<p>CQL3 distinguishes between built-in aggregates (so called `native
aggregates') and <a href="#udas">user-defined aggregates</a>. CQL3 includes
several native aggregates, described below:</p>
</div>
<div class="sect3">
<h4 id="countFct"><a class="anchor" href="#countFct"></a>Count</h4>
<div class="paragraph">
<p>The <code>count</code> function can be used to count the rows returned by a query.
Example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT COUNT (*) FROM plays;<br>
SELECT COUNT (1) FROM plays;</p>
</div>
<div class="paragraph">
<p>It also can be used to count the non null value of a given column.
Example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT COUNT (scores) FROM plays;</p>
</div>
</div>
<div class="sect3">
<h4 id="maxMinFcts"><a class="anchor" href="#maxMinFcts"></a>Max and Min</h4>
<div class="paragraph">
<p>The <code>max</code> and <code>min</code> functions can be used to compute the maximum and the
minimum value returned by a query for a given column.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT MIN (players), MAX (players) FROM plays WHERE game = `quake';</p>
</div>
</div>
<div class="sect3">
<h4 id="sumFct"><a class="anchor" href="#sumFct"></a>Sum</h4>
<div class="paragraph">
<p>The <code>sum</code> function can be used to sum up all the values returned by a
query for a given column.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT SUM (players) FROM plays;</p>
</div>
</div>
<div class="sect3">
<h4 id="avgFct"><a class="anchor" href="#avgFct"></a>Avg</h4>
<div class="paragraph">
<p>The <code>avg</code> function can be used to compute the average of all the values
returned by a query for a given column.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
SELECT AVG (players) FROM plays;</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="udfs"><a class="anchor" href="#udfs"></a>User-Defined Functions</h3>
<div class="paragraph">
<p>User-defined functions allow execution of user-provided code in
Cassandra. By default, Cassandra supports defining functions in <em>Java</em>
and <em>JavaScript</em>. Support for other JSR 223 compliant scripting
languages (such as Python, Ruby, and Scala) has been removed in 3.0.11.</p>
</div>
<div class="paragraph">
<p>UDFs are part of the Cassandra schema. As such, they are automatically
propagated to all nodes in the cluster.</p>
</div>
<div class="paragraph">
<p>UDFs can be <em>overloaded</em> - i.e. multiple UDFs with different argument
types but the same function name. Example:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE FUNCTION sample ( arg int ) …;<br>
CREATE FUNCTION sample ( arg text ) …;</p>
</div>
<div class="paragraph">
<p>User-defined functions are susceptible to all of the normal problems
with the chosen programming language. Accordingly, implementations
should be safe against null pointer exceptions, illegal arguments, or
any other potential source of exceptions. An exception during function
execution will result in the entire statement failing.</p>
</div>
<div class="paragraph">
<p>It is valid to use <em>complex</em> types like collections, tuple types and
user-defined types as argument and return types. Tuple types and
user-defined types are handled by the conversion functions of the
DataStax Java Driver. Please see the documentation of the Java Driver
for details on handling tuple types and user-defined types.</p>
</div>
<div class="paragraph">
<p>Arguments for functions can be literals or terms. Prepared statement
placeholders can be used, too.</p>
</div>
<div class="paragraph">
<p>Note that you can use the double-quoted string syntax to enclose the UDF
source code. For example:</p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE FUNCTION some_function ( arg int )<br>
RETURNS NULL ON NULL INPUT<br>
RETURNS int<br>
LANGUAGE java<br>
AS return arg; ;</p>
</div>
<div class="paragraph">
<p>SELECT some_function(column) FROM atable …;<br>
UPDATE atable SET col = some_function(?) …;<br>
p.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TYPE custom_type (txt text, i int);<br>
CREATE FUNCTION fct_using_udt ( udtarg frozen )<br>
RETURNS NULL ON NULL INPUT<br>
RETURNS text<br>
LANGUAGE java<br>
AS return udtarg.getString(``txt''); ;</p>
</div>
<div class="paragraph">
<p>User-defined functions can be used in <a href="#selectStmt"><code>SELECT</code></a>,
<a href="#insertStmt"><code>INSERT</code></a> and <a href="#updateStmt"><code>UPDATE</code></a> statements.</p>
</div>
<div class="paragraph">
<p>The implicitly available <code>udfContext</code> field (or binding for script UDFs)
provides the neccessary functionality to create new UDT and tuple
values.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
CREATE TYPE custom_type (txt text, i int);<br>
CREATE FUNCTION fct_using_udt ( somearg int )<br>
RETURNS NULL ON NULL INPUT<br>
RETURNS custom_type<br>
LANGUAGE java<br>
AS +
UDTValue udt = udfContext.newReturnUDTValue(); +
udt.setString(``txt'', ``some string''); +
udt.setInt(``i'', 42); +
return udt; +
;</p>
</div>
<div class="paragraph">
<p>The definition of the <code>UDFContext</code> interface can be found in the Apache
Cassandra source code for
<code>org.apache.cassandra.cql3.functions.UDFContext</code>.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
public interface UDFContext<br>
\{<br>
UDTValue newArgUDTValue(String argName);<br>
UDTValue newArgUDTValue(int argNum);<br>
UDTValue newReturnUDTValue();<br>
UDTValue newUDTValue(String udtName);<br>
TupleValue newArgTupleValue(String argName);<br>
TupleValue newArgTupleValue(int argNum);<br>
TupleValue newReturnTupleValue();<br>
TupleValue newTupleValue(String cqlDefinition);<br>
}</p>
</div>
<div class="paragraph">
<p>Java UDFs already have some imports for common interfaces and classes
defined. These imports are:<br>
Please note, that these convenience imports are not available for script
UDFs.</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
import java.nio.ByteBuffer;<br>
import java.util.List;<br>
import java.util.Map;<br>
import java.util.Set;<br>
import org.apache.cassandra.cql3.functions.UDFContext;<br>
import com.datastax.driver.core.TypeCodec;<br>
import com.datastax.driver.core.TupleValue;<br>
import com.datastax.driver.core.UDTValue;</p>
</div>
<div class="paragraph">
<p>See <a href="#createFunctionStmt"><code>CREATE FUNCTION</code></a> and
<a href="#dropFunctionStmt"><code>DROP FUNCTION</code></a>.</p>
</div>
</div>
<div class="sect2">
<h3 id="udas"><a class="anchor" href="#udas"></a>User-Defined Aggregates</h3>
<div class="paragraph">
<p>User-defined aggregates allow creation of custom aggregate functions
using <a href="#udfs">UDFs</a>. Common examples of aggregate functions are
<em>count</em>, <em>min</em>, and <em>max</em>.</p>
</div>
<div class="paragraph">
<p>Each aggregate requires an <em>initial state</em> (<code>INITCOND</code>, which defaults
to <code>null</code>) of type <code>STYPE</code>. The first argument of the state function
must have type <code>STYPE</code>. The remaining arguments of the state function
must match the types of the user-defined aggregate arguments. The state
function is called once for each row, and the value returned by the
state function becomes the new state. After all rows are processed, the
optional <code>FINALFUNC</code> is executed with last state value as its argument.</p>
</div>
<div class="paragraph">
<p><code>STYPE</code> is mandatory in order to be able to distinguish possibly
overloaded versions of the state and/or final function (since the
overload can appear after creation of the aggregate).</p>
</div>
<div class="paragraph">
<p>User-defined aggregates can be used in <a href="#selectStmt"><code>SELECT</code></a>
statement.</p>
</div>
<div class="paragraph">
<p>A complete working example for user-defined aggregates (assuming that a
keyspace has been selected using the <a href="#useStmt"><code>USE</code></a> statement):</p>
</div>
<div class="paragraph">
<p>bc(sample)..<br>
CREATE OR REPLACE FUNCTION averageState ( state tuple&lt;int,bigint&gt;, val
int )<br>
CALLED ON NULL INPUT<br>
RETURNS tuple&lt;int,bigint&gt;<br>
LANGUAGE java<br>
AS ’<br>
if (val != null) \{<br>
state.setInt(0, state.getInt(0)+1);<br>
state.setLong(1, state.getLong(1)+val.intValue());<br>
}<br>
return state;<br>
’;</p>
</div>
<div class="paragraph">
<p>CREATE OR REPLACE FUNCTION averageFinal ( state tuple&lt;int,bigint&gt; )<br>
CALLED ON NULL INPUT<br>
RETURNS double<br>
LANGUAGE java<br>
AS ’<br>
double r = 0;<br>
if (state.getInt(0) == 0) return null;<br>
r = state.getLong(1);<br>
r /= state.getInt(0);<br>
return Double.valueOf®;<br>
’;</p>
</div>
<div class="paragraph">
<p>CREATE OR REPLACE AGGREGATE average ( int )<br>
SFUNC averageState<br>
STYPE tuple&lt;int,bigint&gt;<br>
FINALFUNC averageFinal<br>
INITCOND (0, 0);</p>
</div>
<div class="paragraph">
<p>CREATE TABLE atable (<br>
pk int PRIMARY KEY,<br>
val int);<br>
INSERT INTO atable (pk, val) VALUES (1,1);<br>
INSERT INTO atable (pk, val) VALUES (2,2);<br>
INSERT INTO atable (pk, val) VALUES (3,3);<br>
INSERT INTO atable (pk, val) VALUES (4,4);<br>
SELECT average(val) FROM atable;<br>
p.</p>
</div>
<div class="paragraph">
<p>See <a href="#createAggregateStmt"><code>CREATE AGGREGATE</code></a> and
<a href="#dropAggregateStmt"><code>DROP AGGREGATE</code></a>.</p>
</div>
</div>
<div class="sect2">
<h3 id="json"><a class="anchor" href="#json"></a>JSON Support</h3>
<div class="paragraph">
<p>Cassandra 2.2 introduces JSON support to <a href="#selectStmt"><code>SELECT</code></a> and
<a href="#insertStmt"><code>INSERT</code></a> statements. This support does not
fundamentally alter the CQL API (for example, the schema is still
enforced), it simply provides a convenient way to work with JSON
documents.</p>
</div>
<div class="sect3">
<h4 id="selectJson"><a class="anchor" href="#selectJson"></a>SELECT JSON</h4>
<div class="paragraph">
<p>With <code>SELECT</code> statements, the new <code>JSON</code> keyword can be used to return
each row as a single <code>JSON</code> encoded map. The remainder of the <code>SELECT</code>
statment behavior is the same.</p>
</div>
<div class="paragraph">
<p>The result map keys are the same as the column names in a normal result
set. For example, a statement like <code><code>SELECT JSON a, ttl(b) FROM &#8230;&#8203;&#8217;'
would result in a map with keys `"a"</code> and <code>"ttl(b)"</code>. However, this is
one notable exception: for symmetry with <code>INSERT JSON</code> behavior,
case-sensitive column names with upper-case letters will be surrounded
with double quotes. For example, </code><code>SELECT JSON myColumn FROM &#8230;&#8203;&#8217;'
would result in a map key `"\"myColumn\""</code> (note the escaped quotes).</p>
</div>
<div class="paragraph">
<p>The map values will <code>JSON</code>-encoded representations (as described below)
of the result set values.</p>
</div>
</div>
<div class="sect3">
<h4 id="insertJson"><a class="anchor" href="#insertJson"></a>INSERT JSON</h4>
<div class="paragraph">
<p>With <code>INSERT</code> statements, the new <code>JSON</code> keyword can be used to enable
inserting a <code>JSON</code> encoded map as a single row. The format of the <code>JSON</code>
map should generally match that returned by a <code>SELECT JSON</code> statement on
the same table. In particular, case-sensitive column names should be
surrounded with double quotes. For example, to insert into a table with
two columns named <code>myKey'' and </code>value'', you would do the following:</p>
</div>
<div class="paragraph">
<p>bc(sample).<br>
INSERT INTO mytable JSON `\{<code>\''myKey\</code>'': 0, ``value'': 0}'</p>
</div>
<div class="paragraph">
<p>Any columns which are ommitted from the <code>JSON</code> map will be defaulted to
a <code>NULL</code> value (which will result in a tombstone being created).</p>
</div>
</div>
<div class="sect3">
<h4 id="jsonEncoding"><a class="anchor" href="#jsonEncoding"></a>JSON Encoding of Cassandra Data Types</h4>
<div class="paragraph">
<p>Where possible, Cassandra will represent and accept data types in their
native <code>JSON</code> representation. Cassandra will also accept string
representations matching the CQL literal format for all single-field
types. For example, floats, ints, UUIDs, and dates can be represented by
CQL literal strings. However, compound types, such as collections,
tuples, and user-defined types must be represented by native <code>JSON</code>
collections (maps and lists) or a JSON-encoded string representation of
the collection.</p>
</div>
<div class="paragraph">
<p>The following table describes the encodings that Cassandra will accept
in <code>INSERT JSON</code> values (and <code>from_json()</code> arguments) as well as the
format Cassandra will use when returning data for <code>SELECT JSON</code>
statements (and <code>from_json()</code>):</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">type</th>
<th class="tableblock halign-left valign-top">formats accepted</th>
<th class="tableblock halign-left valign-top">return format</th>
<th class="tableblock halign-left valign-top">notes</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ascii</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s <code>\u</code> character escape</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bigint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be valid 64 bit integer</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>blob</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String should be 0x followed by an even number
of hex digits</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>boolean</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be <code>true'' or
</code>false''</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Date in format <code>YYYY-MM-DD</code>, timezone UTC</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>decimal</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, float, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">float</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">May exceed 32 or 64-bit
IEEE-754 floating point precision in client-side decoder</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>double</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, float, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">float</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be valid integer
or float</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>float</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, float, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">float</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be valid integer or
float</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>inet</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">IPv4 or IPv6 address</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>int</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be valid 32 bit integer</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>list</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">list, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">list</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s native list representation</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>map</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">map, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">map</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s native map representation</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>smallint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be valid 16 bit
integer</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>set</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">list, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">list</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s native list representation</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s <code>\u</code> character escape</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>time</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Time of day in format <code>HH-MM-SS[.fffffffff]</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timestamp</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">A timestamp. Strings constant are
allow to input timestamps as dates, see <a href="#usingdates">Working with
dates</a> below for more information. Datestamps with format
<code>YYYY-MM-DD HH:MM:SS.SSS</code> are returned.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>timeuuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Type 1 UUID. See <a href="#constants">Constants</a>
for the UUID format</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tinyint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">String must be valid 8 bit integer</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>tuple</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">list, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">list</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s native list representation</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UDT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">map, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">map</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s native map representation with
field names as keys</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>uuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">See <a href="#constants">Constants</a> for the UUID
format</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>varchar</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Uses JSON’s <code>\u</code> character escape</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>varint</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer, string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Variable length; may overflow 32 or
64 bit integers in client-side decoder</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="from_json"><a class="anchor" href="#from_json"></a>The from_json() Function</h4>
<div class="paragraph">
<p>The <code>from_json()</code> function may be used similarly to <code>INSERT JSON</code>, but
for a single column value. It may only be used in the <code>VALUES</code> clause of
an <code>INSERT</code> statement or as one of the column values in an <code>UPDATE</code>,
<code>DELETE</code>, or <code>SELECT</code> statement. For example, it cannot be used in the
selection clause of a <code>SELECT</code> statement.</p>
</div>
</div>
<div class="sect3">
<h4 id="to_json"><a class="anchor" href="#to_json"></a>The to_json() Function</h4>
<div class="paragraph">
<p>The <code>to_json()</code> function may be used similarly to <code>SELECT JSON</code>, but for
a single column value. It may only be used in the selection clause of a
<code>SELECT</code> statement.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="appendixA"><a class="anchor" href="#appendixA"></a>Appendix A: CQL Keywords</h3>
<div class="paragraph">
<p>CQL distinguishes between <em>reserved</em> and <em>non-reserved</em> keywords.
Reserved keywords cannot be used as identifier, they are truly reserved
for the language (but one can enclose a reserved keyword by
double-quotes to use it as an identifier). Non-reserved keywords however
only have a specific meaning in certain context but can used as
identifer otherwise. The only <em>raison d’être</em> of these non-reserved
keywords is convenience: some keyword are non-reserved when it was
always easy for the parser to decide whether they were used as keywords
or not.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Keyword</th>
<th class="tableblock halign-left valign-top">Reserved?</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ADD</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AGGREGATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALL</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALLOW</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ALTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AND</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>APPLY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ASC</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ASCII</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>AUTHORIZE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>BATCH</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>BEGIN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>BIGINT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>BLOB</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>BOOLEAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>BY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CALLED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CAST</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CLUSTERING</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>COLUMNFAMILY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>COMPACT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CONTAINS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>COUNT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>COUNTER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CREATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CUSTOM</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DECIMAL</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DEFAULT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DELETE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DESC</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DESCRIBE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DISTINCT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DOUBLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DROP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DURATION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ENTRIES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXECUTE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EXISTS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FILTERING</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FINALFUNC</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FLOAT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FROM</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FROZEN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FULL</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FUNCTION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>FUNCTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GRANT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GROUP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>IF</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>IN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INDEX</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INET</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INFINITY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INITCOND</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INPUT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INSERT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>INTO</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>IS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>JSON</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>KEYSPACES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LANGUAGE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LIKE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LIMIT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LIST</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LOGIN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MAP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MASKED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MATERIALIZED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MBEANS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>MODIFY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NAN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NOLOGIN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NORECURSIVE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NOSUPERUSER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NOT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>NULL</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>OF</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ON</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>OPTIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>OR</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ORDER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PARTITION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PASSWORD</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PERMISSION</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PERMISSIONS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PRIMARY</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>RENAME</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>REPLACE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>RETURNS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>REVOKE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ROLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>ROLES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SCHEMA</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SELECT_MASKED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SET</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SFUNC</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SMALLINT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>STATIC</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>STORAGE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>STYPE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SUPERUSER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TABLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TEXT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TIME</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TIMESTAMP</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TIMEUUID</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TINYINT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TO</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TOKEN</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TRIGGER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TRUNCATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TTL</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TUPLE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>TYPE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UNLOGGED</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UNMASK</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UNSET</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UPDATE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>USE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>USER</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>USERS</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>USING</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>UUID</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>VALUES</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>VARCHAR</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>VARINT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>VIEW</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>WHERE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>WITH</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">yes</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>WRITETIME</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">no</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="appendixB"><a class="anchor" href="#appendixB"></a>Appendix B: CQL Reserved Types</h3>
<div class="paragraph">
<p>The following type names are not currently used by CQL, but are reserved
for potential future use. User-defined types may not use reserved type
names as their name.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 100%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">type</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bitstring</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>byte</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>complex</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>enum</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>interval</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>macaddr</code></p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="changes"><a class="anchor" href="#changes"></a>Changes</h3>
<div class="paragraph">
<p>The following describes the changes in each version of CQL.</p>
</div>
<div class="sect3">
<h4 id="3-4-3"><a class="anchor" href="#3-4-3"></a>3.4.3</h4>
<div class="ulist">
<ul>
<li>
<p>Support for <code>GROUP BY</code>. See <a href="#selectGroupBy"><code>&lt;group-by&gt;</code></a> (see
<a href="https://issues.apache.org/jira/browse/CASSANDRA-10707)">CASSANDRA-10707</a>.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-4-2"><a class="anchor" href="#3-4-2"></a>3.4.2</h4>
<div class="ulist">
<ul>
<li>
<p>Support for selecting elements and slices of a collection
(<a href="https://issues.apache.org/jira/browse/CASSANDRA-7396)">CASSANDRA-7396</a>.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-4-2-2"><a class="anchor" href="#3-4-2-2"></a>3.4.2</h4>
<div class="ulist">
<ul>
<li>
<p><a href="#updateOptions"><code>INSERT/UPDATE options</code></a> for tables having a
default_time_to_live specifying a TTL of 0 will remove the TTL from the
inserted or updated values</p>
</li>
<li>
<p><a href="#alterTableStmt"><code>ALTER TABLE</code></a> <code>ADD</code> and <code>DROP</code> now allow mutiple
columns to be added/removed</p>
</li>
<li>
<p>New <a href="#selectLimit"><code>PER PARTITION LIMIT</code></a> option (see
<a href="https://issues.apache.org/jira/browse/CASSANDRA-7017)">CASSANDRA-7017</a>.</p>
</li>
<li>
<p><a href="#udfs">User-defined functions</a> can now instantiate <code>UDTValue</code> and
<code>TupleValue</code> instances via the new <code>UDFContext</code> interface (see
<a href="https://issues.apache.org/jira/browse/CASSANDRA-10818)">CASSANDRA-10818</a>.</p>
</li>
<li>
<p><code>`User-defined types''#createTypeStmt may now be stored in a
non-frozen form, allowing individual fields to be updated and deleted in
<a href="#updateStmt">`UPDATE</code> statements</a> and <a href="#deleteStmt"><code>DELETE</code>
statements</a>, respectively.
(<a href="https://issues.apache.org/jira/browse/CASSANDRA-7423)">CASSANDRA-7423</a></p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-4-1"><a class="anchor" href="#3-4-1"></a>3.4.1</h4>
<div class="ulist">
<ul>
<li>
<p>Adds <code>CAST</code> functions. See <a href="#castFun"><code>Cast</code></a>.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-4-0"><a class="anchor" href="#3-4-0"></a>3.4.0</h4>
<div class="ulist">
<ul>
<li>
<p>Support for <a href="#createMVStmt">materialized views</a></p>
</li>
<li>
<p><a href="#deleteStmt"><code>DELETE</code></a> support for inequality expressions and <code>IN</code>
restrictions on any primary key columns</p>
</li>
<li>
<p><a href="#updateStmt"><code>UPDATE</code></a> support for <code>IN</code> restrictions on any
primary key columns</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-3-1"><a class="anchor" href="#3-3-1"></a>3.3.1</h4>
<div class="ulist">
<ul>
<li>
<p>The syntax <code>TRUNCATE TABLE X</code> is now accepted as an alias for
<code>TRUNCATE X</code></p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-3-0"><a class="anchor" href="#3-3-0"></a>3.3.0</h4>
<div class="ulist">
<ul>
<li>
<p>Adds new <a href="#aggregates">aggregates</a></p>
</li>
<li>
<p>User-defined functions are now supported through
<a href="#createFunctionStmt"><code>CREATE FUNCTION</code></a> and
<a href="#dropFunctionStmt"><code>DROP FUNCTION</code></a>.</p>
</li>
<li>
<p>User-defined aggregates are now supported through
<a href="#createAggregateStmt"><code>CREATE AGGREGATE</code></a> and
<a href="#dropAggregateStmt"><code>DROP AGGREGATE</code></a>.</p>
</li>
<li>
<p>Allows double-dollar enclosed strings literals as an alternative to
single-quote enclosed strings.</p>
</li>
<li>
<p>Introduces Roles to supercede user based authentication and access
control</p>
</li>
<li>
<p><a href="#usingdates"><code>Date</code></a> and <a href="usingtime"><code>Time</code></a> data types have
been added</p>
</li>
<li>
<p><a href="#json"><code>JSON</code></a> support has been added</p>
</li>
<li>
<p><code>Tinyint</code> and <code>Smallint</code> data types have been added</p>
</li>
<li>
<p>Adds new time conversion functions and deprecate <code>dateOf</code> and
<code>unixTimestampOf</code>. See <a href="#timeFun"><code>Time conversion functions</code></a></p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-2-0"><a class="anchor" href="#3-2-0"></a>3.2.0</h4>
<div class="ulist">
<ul>
<li>
<p>User-defined types are now supported through
<a href="#createTypeStmt"><code>CREATE TYPE</code></a>, <a href="#alterTypeStmt"><code>ALTER TYPE</code></a>,
and <a href="#dropTypeStmt"><code>DROP TYPE</code></a></p>
</li>
<li>
<p><a href="#createIndexStmt"><code>CREATE INDEX</code></a> now supports indexing collection
columns, including indexing the keys of map collections through the
<code>keys()</code> function</p>
</li>
<li>
<p>Indexes on collections may be queried using the new <code>CONTAINS</code> and
<code>CONTAINS KEY</code> operators</p>
</li>
<li>
<p>Tuple types were added to hold fixed-length sets of typed positional
fields (see the section on <a href="#types">types</a> )</p>
</li>
<li>
<p><a href="#dropIndexStmt"><code>DROP INDEX</code></a> now supports optionally specifying a
keyspace</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-7"><a class="anchor" href="#3-1-7"></a>3.1.7</h4>
<div class="ulist">
<ul>
<li>
<p><code>SELECT</code> statements now support selecting multiple rows in a single
partition using an <code>IN</code> clause on combinations of clustering columns.
See <a href="#selectWhere">SELECT WHERE</a> clauses.</p>
</li>
<li>
<p><code>IF NOT EXISTS</code> and <code>IF EXISTS</code> syntax is now supported by
<code>CREATE USER</code> and <code>DROP USER</code> statmenets, respectively.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-6"><a class="anchor" href="#3-1-6"></a>3.1.6</h4>
<div class="ulist">
<ul>
<li>
<p>A new <a href="#uuidFun"><code>uuid</code> method</a> has been added.</p>
</li>
<li>
<p>Support for <code>DELETE &#8230;&#8203; IF EXISTS</code> syntax.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-5"><a class="anchor" href="#3-1-5"></a>3.1.5</h4>
<div class="ulist">
<ul>
<li>
<p>It is now possible to group clustering columns in a relatiion, see
<a href="#selectWhere">SELECT WHERE</a> clauses.</p>
</li>
<li>
<p>Added support for <code>STATIC</code> columns, see <a href="#createTableStatic">static
in CREATE TABLE</a>.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-4"><a class="anchor" href="#3-1-4"></a>3.1.4</h4>
<div class="ulist">
<ul>
<li>
<p><code>CREATE INDEX</code> now allows specifying options when creating CUSTOM
indexes (see <a href="#createIndexStmt">CREATE INDEX reference</a> ).</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-3"><a class="anchor" href="#3-1-3"></a>3.1.3</h4>
<div class="ulist">
<ul>
<li>
<p>Millisecond precision formats have been added to the timestamp parser
(see <a href="#usingtimestamps">working with dates</a> ).</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-2"><a class="anchor" href="#3-1-2"></a>3.1.2</h4>
<div class="ulist">
<ul>
<li>
<p><code>NaN</code> and <code>Infinity</code> has been added as valid float contants. They are
now reserved keywords. In the unlikely case you we using them as a
column identifier (or keyspace/table one), you will noew need to double
quote them (see <a href="#identifiers">quote identifiers</a> ).</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-1"><a class="anchor" href="#3-1-1"></a>3.1.1</h4>
<div class="ulist">
<ul>
<li>
<p><code>SELECT</code> statement now allows listing the partition keys (using the
<code>DISTINCT</code> modifier). See
<a href="https://issues.apache.org/jira/browse/CASSANDRA-4536">CASSANDRA-4536</a>.</p>
</li>
<li>
<p>The syntax <code>c IN ?</code> is now supported in <code>WHERE</code> clauses. In that case,
the value expected for the bind variable will be a list of whatever type
<code>c</code> is.</p>
</li>
<li>
<p>It is now possible to use named bind variables (using <code>:name</code> instead
of <code>?</code>).</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-1-0"><a class="anchor" href="#3-1-0"></a>3.1.0</h4>
<div class="ulist">
<ul>
<li>
<p><a href="#alterTableStmt">ALTER TABLE</a> <code>DROP</code> option has been reenabled for
CQL3 tables and has new semantics now: the space formerly used by
dropped columns will now be eventually reclaimed (post-compaction). You
should not readd previously dropped columns unless you use timestamps
with microsecond precision (see
<a href="https://issues.apache.org/jira/browse/CASSANDRA-3919">CASSANDRA-3919</a> for
more details).</p>
</li>
<li>
<p><code>SELECT</code> statement now supports aliases in select clause. Aliases in
WHERE and ORDER BY clauses are not supported. See the
<a href="#selectStmt">section on select</a> for details.</p>
</li>
<li>
<p><code>CREATE</code> statements for <code>KEYSPACE</code>, <code>TABLE</code> and <code>INDEX</code> now supports
an <code>IF NOT EXISTS</code> condition. Similarly, <code>DROP</code> statements support a
<code>IF EXISTS</code> condition.</p>
</li>
<li>
<p><code>INSERT</code> statements optionally supports a <code>IF NOT EXISTS</code> condition
and <code>UPDATE</code> supports <code>IF</code> conditions.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-0-5"><a class="anchor" href="#3-0-5"></a>3.0.5</h4>
<div class="ulist">
<ul>
<li>
<p><code>SELECT</code>, <code>UPDATE</code>, and <code>DELETE</code> statements now allow empty <code>IN</code>
relations (see
<a href="https://issues.apache.org/jira/browse/CASSANDRA-5626)">CASSANDRA-5626</a>.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-0-4"><a class="anchor" href="#3-0-4"></a>3.0.4</h4>
<div class="ulist">
<ul>
<li>
<p>Updated the syntax for custom <a href="#createIndexStmt">secondary
indexes</a>.</p>
</li>
<li>
<p>Non-equal condition on the partition key are now never supported, even
for ordering partitioner as this was not correct (the order was <strong>not</strong>
the one of the type of the partition key). Instead, the <code>token</code> method
should always be used for range queries on the partition key (see
<a href="#selectWhere">WHERE clauses</a> ).</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-0-3"><a class="anchor" href="#3-0-3"></a>3.0.3</h4>
<div class="ulist">
<ul>
<li>
<p>Support for custom <a href="#createIndexStmt">secondary indexes</a> has been
added.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-0-2"><a class="anchor" href="#3-0-2"></a>3.0.2</h4>
<div class="ulist">
<ul>
<li>
<p>Type validation for the <a href="#constants">constants</a> has been fixed. For
instance, the implementation used to allow <code>'2'</code> as a valid value for an
<code>int</code> column (interpreting it has the equivalent of <code>2</code>), or <code>42</code> as a
valid <code>blob</code> value (in which case <code>42</code> was interpreted as an hexadecimal
representation of the blob). This is no longer the case, type validation
of constants is now more strict. See the <a href="#types">data types</a> section
for details on which constant is allowed for which type.</p>
</li>
<li>
<p>The type validation fixed of the previous point has lead to the
introduction of <a href="#constants">blobs constants</a> to allow inputing
blobs. Do note that while inputing blobs as strings constant is still
supported by this version (to allow smoother transition to blob
constant), it is now deprecated (in particular the <a href="#types">data
types</a> section does not list strings constants as valid blobs) and will
be removed by a future version. If you were using strings as blobs, you
should thus update your client code ASAP to switch blob constants.</p>
</li>
<li>
<p>A number of functions to convert native types to blobs have also been
introduced. Furthermore the token function is now also allowed in select
clauses. See the <a href="#functions">section on functions</a> for details.</p>
</li>
</ul>
</div>
</div>
<div class="sect3">
<h4 id="3-0-1"><a class="anchor" href="#3-0-1"></a>3.0.1</h4>
<div class="ulist">
<ul>
<li>
<p><a href="#usingtimestamps">Date strings</a> (and timestamps) are no longer
accepted as valid <code>timeuuid</code> values. Doing so was a bug in the sense
that date string are not valid <code>timeuuid</code>, and it was thus resulting in
<a href="https://issues.apache.org/jira/browse/CASSANDRA-4936">confusing
behaviors</a>. However, the following new methods have been added to help
working with <code>timeuuid</code>: <code>now</code>, <code>minTimeuuid</code>, <code>maxTimeuuid</code> , <code>dateOf</code>
and <code>unixTimestampOf</code>. See the <a href="#timeuuidFun">section dedicated to
these methods</a> for more detail.</p>
</li>
<li>
<p><code>`Float constants''#constants now support the exponent notation. In
other words, `4.2E10</code> is now a valid floating point value.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect2">
<h3 id="versioning"><a class="anchor" href="#versioning"></a>Versioning</h3>
<div class="paragraph">
<p>Versioning of the CQL language adheres to the <a href="http://semver.org">Semantic
Versioning</a> guidelines. Versions take the form X.Y.Z where X, Y, and Z
are integer values representing major, minor, and patch level
respectively. There is no correlation between Cassandra release versions
and the CQL language version.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">version</th>
<th class="tableblock halign-left valign-top">description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Major</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The major version <em>must</em> be bumped when backward incompatible
changes are introduced. This should rarely occur.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Minor</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Minor version increments occur when new, but backward
compatible, functionality is introduced.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Patch</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">The patch version is incremented when bugs are fixed.</p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</article>
</main>
</div>
</div>
<footer class="grad grad--two flex-center pb-xlarge">
<div class="inner text-center z2 relative">
<h2 class="white py-small">Get started with Cassandra, fast.</h2>
<a id="footer-cta" href="/_/quickstart.html" class="btn btn--filled ma-medium">Quickstart Guide</a>
</div>
<div class="inner flex flex-distribute-items mt-xlarge z2 relative">
<div class="col-2">
<div id="footer-logo" class="logo logo--footer mb-medium"><img src="../../../../../assets/img/logo-white-r.png" alt="Cassandra Logo"></div>
<p>Apache Cassandra<img src="../../../../../assets/img/registered.svg" alt="®" style="width:18px;"> powers mission-critical deployments with improved performance and unparalleled levels of scale in the cloud.</p>
<div class="footer-social-icons">
<a href="https://twitter.com/cassandra?lang=en" target="_blank"><img src="../../../../../assets/img/twitter-icon-circle-white.svg" alt="twitter icon" width="24"></a>
<a href="https://www.linkedin.com/company/apache-cassandra/" target="_blank"><img src="../../../../../assets/img/LI-In-Bug.png" alt="linked-in icon" width="24"></a>
<a href="https://www.youtube.com/c/PlanetCassandra" target="_blank"><img src="../../../../../assets/img/youtube-icon.png" alt="youtube icon" width="24"></a>
</div>
</div>
<div class="col-2 flex flex-center">
<ul class="columns-2">
<li class="mb-small"><a href="/">Home</a></li>
<li class="mb-small"><a href="/_/cassandra-basics.html">Cassandra Basics</a></li>
<li class="mb-small"><a href="/_/quickstart.html">Quickstart</a></li>
<li class="mb-small"><a href="/_/ecosystem.html">Ecosystem</a></li>
<li class="mb-small"><a href="/doc/latest/">Documentation</a></li>
<li class="mb-small"><a href="/_/community.html">Community</a></li>
<li class="mb-small"><a href="/_/case-studies.html">Case Studies</a></li>
<li class="mb-small"><a href="/_/resources.html">Resources</a></li>
<li class="mb-small"><a href="/_/blog.html">Blog</a></li>
</ul>
</div>
</div>
</footer>
<div class="lower-footer bg-white pa-medium">
<div class="flex flex-row flex-vert-center">
<div class="pr-medium"><img src="../../../../../assets/img//feather-small.png" alt="ASF" width="20"></div>
<div class="pr-medium"><a href="http://www.apache.org/" target="_blank">Foundation</a></div>
<div class="pr-medium"><a href="https://www.apache.org/events/current-event.html" target="_blank">Events</a></div>
<div class="pr-medium"><a href="https://www.apache.org/licenses/" target="_blank">License</a></div>
<div class="pr-medium"><a href="https://www.apache.org/foundation/thanks" target="_blank">Thanks</a></div>
<div class="pr-medium"><a href="https://www.apache.org/security" target="_blank">Security</a></div>
<div class="pr-medium"><a href="https://privacy.apache.org/policies/privacy-policy-public.html" target="_blank">Privacy</a></div>
<div class="pr-medium"><a href="https://www.apache.org/foundation/sponsorship" target="_blank">Sponsorship</a></div>
</div>
<p class="my-medium">© 2009-<script>document.write(new Date().getFullYear())</script> <a href="https://apache.org" target="_blank">The Apache Software Foundation</a> under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation.</p>
</div>
<div id="fade" class="hidden"></div>
<div id="modal" class="hidden">
<div id="close-modal" class="cursor-pointer"><svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></div>
<div id="mod-content" class="vid-mod-content resp-container"></div>
</div>
<script src="../../../../../assets/js/site.js"></script>
<script async src="../../../../../assets/js/vendor/highlight.js"></script>
<script src="../../../../../assets/js/vendor/lunr.js"></script>
<script src="../../../../../assets/js/vendor/search.js" id="search-script" data-base-path="../../../../.." data-page-path="/Cassandra/5.0/cassandra/developing/cql/cql_singlefile.html"></script>
<script async src="../../../../../assets/../search-index.js"></script>
<script>
jQuery(function(){
var windowW = $(window).width();
$(document)
.on('click','.mobile-nav-icon',function(){
$('.main-nav').fadeIn();
})
.on('click','.main-nav',function(){
if(windowW <= 1000){
$(this).fadeOut();
}
})
.on('click','#version-toggle',function(){
$(this).toggleClass('active');
$(this).next().fadeToggle();
})
.on('click','#mobile-docs-nav-burger', function(){
$(this).toggleClass('active');
$('.docs-nav').toggleClass('active');
});
var url = window.location.pathname;
var isQuickstart = url.includes('quickstart.html');
if(isQuickstart){
var footerCTA = document.getElementById('footer-cta');
footerCTA.innerHTML = 'Get latest updates';
footerCTA.setAttribute('href', '/_/blog.html');
}
});
</script>
</div>
</body>
</html>