TEXT type

Synopsis

Use the TEXT data type to specify data of a string of Unicode characters.

Syntax

type_specification ::= TEXT | VARCHAR

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

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

See also