Boolean Data Type in Cassandra Query Language - Cassandra / CQL Tutorial

Boolean Data Type in Cassandra Query Language ( CQL)

If you need to store true or false value, you can use Boolean data type in Cassandra Query Language ( CQL).  In below example, I have created tbs table with column IsActive as Boolean data type.
CQLSH:techbrotherstutorials>CREATE TABLE tbs 
                          id       INT PRIMARY KEY, 
                          NAME     VARCHAR, 
                          isactive BOOLEAN 

Let's insert couple of values in out table by using CQL, Rember we will be only able to insert ture of false value in boolean data type column.
CQLSH:techbrotherstutorials>INSERT INTO tbs 
            (id, NAME,isactive ) 
            VALUES ( 1, 'Aamir', true);

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

Check the data by using Select statement 
CQLSH:techbrotherstutorials>SELECT * FROM   tbs; 

1 comment: