In this learning unit, you will:
- Create tables using the CQL
- Learn about tables with single-row partitions
- Understand the difference between simple and composite partition keys
- Practice several useful CQL statements and CQL shell commands that work with tables
This scenario is also available on our datastax.com/dev site, where you can find many more resources to help you succeed with Apache Cassandra™.
Tables with Single-Row Partitions in Apache Cassandra™
Tables, columns, data types, rows, partitions, keys, ordering
A table in Apache Cassandra™ shares many similarities with a table in a relational database. It has named columns with data types and rows with values. A primary key uniquely identifies a row in a table.
There are also important differences. In Cassandra, on one hand, a table is a set of rows containing values and, on the other hand, a table is also a set of partitions containing rows. Specifically, each row belongs to exactly one partition and each partition contains one or more rows. A primary key consists of a mandatory partition key and optional clustering key, where a partition key uniquely identifies a partition in a table and a clustering key uniquely identifies a row in a partition.
A table with single-row partitions is a table where there is exactly one row per partition. A table with single-row partitions defines a primary key to be equivalent to a partition key.
A table with multi-row partitions is a table where there can be one or more rows per partition. A table with multi-row partitions defines a primary key to be a combination of both partition and clustering keys. Rows in the same partition have the same partition key values and are ordered based on their clustering key values using the default ascendant order.