Challenge your understanding of Cassandra's data modeling concepts with questions on keyspaces, tables, column types, and structure. Learn to recognize foundational terms and best practices crucial for effective schema design in distributed databases.
Which statement best describes a keyspace in Cassandra?
Explanation: A keyspace in Cassandra acts as a logical namespace for grouping tables and defining replication settings. It is not a row within a table, which is a data unit, nor is it a column or a value that identifies columns. Keyspaces are at the highest level in Cassandra's data hierarchy, while the other options refer to lower-level structures.
In Cassandra, what is a table primarily used for within a keyspace?
Explanation: Tables in Cassandra are designed to store and organize rows of related data within a keyspace. The other options refer to cluster configuration (number of nodes), permissions management, or query metrics, none of which describe the purpose of a table.
What is the main role of a primary key when creating a table in Cassandra?
Explanation: A primary key ensures each row in a table can be uniquely identified and efficiently retrieved. It does not define column data types, handle user permissions, or manage replication strategies; those are managed in different ways within Cassandra.
Which of the following is a valid data type for a column in Cassandra tables?
Explanation: The 'text' data type is used for storing string values in Cassandra columns. 'File', 'widget', and 'panel' are not valid data types in Cassandra and don't correspond to supported storage formats.
In Cassandra data modeling, what is the main purpose of the partition key?
Explanation: Partition keys dictate how rows are distributed across the nodes in the cluster, thereby impacting data locality and performance. They do not set default values, manage user permissions, or handle data encryption; these are managed elsewhere.
What is the main function of clustering columns in a Cassandra table?
Explanation: Clustering columns are used to sort the data within each partition, allowing for efficient range queries. Backing up keyspaces and network configuration are not related to clustering columns, and determining the partition key is defined separately from clustering columns.
Which constraint can be enforced on a Cassandra table column?
Explanation: Cassandra supports defining a primary key constraint to ensure row uniqueness. However, it does not natively enforce unique, foreign key, or check constraints as found in some other database systems.
What is the primary characteristic of a static column in a Cassandra table?
Explanation: A static column's value is the same for all rows within a given partition, making it useful for partition-level attributes. Static columns are not restricted to numeric values, can be updated, and have no naming requirements like starting with 'static_'.
How does Cassandra treat keyspace, table, and column names by default?
Explanation: Unquoted keyspace, table, and column names are converted to lowercase by default. Names are not required to be in uppercase, are not always case-sensitive, and there is no length restriction of exactly 8 characters.
Which statement about adding columns to an existing table in Cassandra is correct?
Explanation: Cassandra allows the addition of new columns whenever necessary, and existing rows are left unaffected—missing values are simply handled as null. There is no hard limit of 50 columns, and the other distractors misrepresent how schema evolution and deletions work in Cassandra.