Int Data Type in Cassandra Query Language ( CQL) - Cassandra / CQL Tutorial

Int Data Type in Cassandra Query Language ( CQL)

Int data type in Cassandra Query Language ( CQL) takes 4 Bytes to save Integer value. The values those you can save in Integer data type in CQL range
from -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647).
Let's create a table with Integer data type in CQL and insert couple of values for test. Both columns (id and intvalue) are integer type in tbs table.

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

Insert values into table by using below CQL statement  
CQLSH:techbrotherstutorials>INSERT INTO tbs   (  id,  intvalue  ) 
            VALUES    (   1,-20000  );
CQLSH:techbrotherstutorials>INSERT INTO tbs (   id,  intvalue  ) 
            VALUES    (    2,500000   );

Use the Select query in CQL to check the records in table.
CQLSH:techbrotherstutorials>SELECT * 
FROM   tbs; 

1 comment: