Text Data Type in Cassandra - Cassandra / CQL Tutorial

Text Data Type in Cassandra

Text data type in Cassandra is used to save UTF-8 encoded string values. In below example, I am creating a table with column "Name" as Text data type and inserting couple of records for test.

CQLSH:techbrotherstutorials>CREATE TABLE tbs 
             ( 
                          id INT PRIMARY KEY, 
                          NAME TEXT 
             );

 

Insert records in table by using CQL insert statement

CQLSH:techbrotherstutorials>INSERT INTO tbs 
            ( 
                        id, 
                        NAME 
            ) 
            VALUES 
            ( 
                        1, 
                        'Doe John' 
            );

 

CQLSH:techbrotherstutorials>INSERT INTO tbs 
            ( 
                        id, 
                        NAME 
            ) 
            VALUES 
            ( 
                        2, 
                        'Test_Text_123' 
            );

 Check the data in table by using Select statement in CQL

CQLSH:techbrotherstutorials>SELECT * 
FROM   tbs;