TEXT type
Synopsis
TEXT
data type is used to specify data of a string of unicode characters.
Syntax
type_specification ::= TEXT | VARCHAR
text_literal ::= "'" [ letter ...] "'"
Where
TEXT
andVARCHAR
are aliases.letter
is any character except for single quote ([^']
)
Semantics
- Columns of type
TEXT
orVARCHAR
can be part of thePRIMARY 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
cqlsh:example> CREATE TABLE users(user_name TEXT PRIMARY KEY, full_name VARCHAR);
cqlsh:example> INSERT INTO users(user_name, full_name) VALUES ('jane', 'Jane Doe');
cqlsh:example> INSERT INTO users(user_name, full_name) VALUES ('john', 'John Doe');
cqlsh:example> UPDATE users set full_name = 'Jane Poe' WHERE user_name = 'jane';
cqlsh:example> SELECT * FROM users;
user_name | full_name
-----------+-----------
jane | Jane Poe
john | John Doe
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .