List Data Type in Cassandra
When you need to store list of elements such as list of textual, integer or other data types then you can use List Collection type. To use List collection type, first you have to declare List and then data type of elements e.g List<Text> or List<integer>In below example, I am creating a table which has parent name, Children Column which is declared as List Collection of Text type and ChildrenAge as List of Integers.
CQLSH:techbrotherstutorials>CREATE TABLE tbs
(
id INT PRIMARY KEY,
NAME TEXT,
children LIST<text>,
childrenage LIST<smallint> ;
(
id INT PRIMARY KEY,
NAME TEXT,
children LIST<text>,
childrenage LIST<smallint> ;
Let's insert a record in table, for List Collection, you will be using [ element1, element2.....]
CQLSH:techbrotherstutorials>INSERT INTO tbs
(
id,
NAME,
children,
childrenage
)
VALUES
(
1,
'Aamir',
['najaf','rida'],
[15,14]
);
(
id,
NAME,
children,
childrenage
)
VALUES
(
1,
'Aamir',
['najaf','rida'],
[15,14]
);
Let's verify the data by using Select statement in CQL
CQLSH:techbrotherstutorials>SELECT *
FROM tbs;
FROM tbs;
Liên hệ Aivivu, đặt vé máy bay tham khảo
ReplyDeleteVé máy bay đi Mỹ
vé máy bay hà nội sài gòn tháng 12
vé máy bay cần thơ hà nội vietnam airline
giá vé máy bay vào nha trang
giá vé máy bay bamboo đi quy nhơn
dịch vụ taxi sân bay