Srinidhi
Srinidhi

Reputation: 31

Questions on Cassandra data types

I am new to cassandra and would like to know about the following:

  1. How do I set a default value for a column.
  2. How do I define a char data type or at least define a size for varchar something like varchar(100) in mysql.
  3. how do I specify if a column can have null values or not.
  4. How auto-increment feature can be done.

Thanks.

Upvotes: 1

Views: 1089

Answers (1)

Tamil
Tamil

Reputation: 5358

Default Value for a column & Column can null values or not

These two features makes sense in relational model where proper schema is a must. But cassandra is originally built for schema less architecture [this doesn't mean that you can't use it for a data model with proper schema]. Although column families support column_metadata it is just a relaxed constraint.

In static column families, although the rows generally have the same set of columns, they are not required to have all of the columns defined

Refered from the same doc

How do I define a char data type or at least define a size for varchar something like varchar(100)

Cassandra by default has ascii & uft8 type

How auto-increment feature can be done

Requirement is same as this so post. Direct answer is no.

Upvotes: 2

Related Questions