Synopsis
Use the TEXT data type to specify data of a string of Unicode characters.
Syntax
type_specification ::= TEXT | VARCHAR
text_literal ::= "'" [ letter ...] "'"
Where
TEXTandVARCHARare aliases.letteris any character except for single quote ([^'])
Semantics
- Columns of type
TEXTorVARCHARcan be part of thePRIMARY KEY. - Implicitly, value of type
TEXTdata type are neither convertible nor comparable to non-text data types. - The length of
TEXTstring 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