TEXT type

Synopsis

TEXT data type is used to specify data of a string of unicode characters.

Syntax

  1. type_specification ::= TEXT | VARCHAR
  2. text_literal ::= "'" [ letter ...] "'"

Where

  • TEXT and VARCHAR are aliases.
  • letter is any character except for single quote ([^'])

Semantics

  • Columns of type TEXT or VARCHAR can be part of the PRIMARY KEY.
  • Implicitly, value of type TEXT data type are neither convertible nor comparable to non-text data types.
  • The length of TEXT string is virtually unlimited.

Examples

  1. cqlsh:example> CREATE TABLE users(user_name TEXT PRIMARY KEY, full_name VARCHAR);
  1. cqlsh:example> INSERT INTO users(user_name, full_name) VALUES ('jane', 'Jane Doe');
  1. cqlsh:example> INSERT INTO users(user_name, full_name) VALUES ('john', 'John Doe');
  1. cqlsh:example> UPDATE users set full_name = 'Jane Poe' WHERE user_name = 'jane';
  1. cqlsh:example> SELECT * FROM users;
  1. user_name | full_name
  2. -----------+-----------
  3. jane | Jane Poe
  4. john | John Doe

See also