Duration Data Type in Cassandra
Duration data type in Cassandra is used to store a duration value with nanosecond precision. When you need to store Duration, you will be using format Quantity+Unit. Below is the list of Units
y: years
mo: months
w: weeks
d: days
h: hours
m: minutes
s: seconds
ms: milliseconds
us or µs : microseconds
ns: nanoseconds
Let's say that If I have to save 12 hours 57 minutes and 43 seconds then I will write like 12h57m43s.
In below example, I am going to create the tbs table with column durationcolumn of data type duration and insert couple of records.
(
id INT PRIMARY KEY,
durationcolumn DURATION,
NAME TEXT
);
Insert couple of recrods in table by using below CQL scripts
(
id,
durationcolumn,
NAME
)
VALUES
(
1,
12h57m43s,
'Doe John'
);
(
id,
durationcolumn,
NAME
)
VALUES
(
2,
10y11mo24d9h23m34s45ms100us123ns,
'Mike'
);
Check the data by using CQL Select statement
FROM tbs;
Mua vé tại Aivivu, tham khảo
ReplyDeleteVé máy bay đi Mỹ
về việt nam từ mỹ
chuyến bay thương mại từ canada về việt nam
giá vé máy bay từ nhật về việt nam
Giá vé máy bay Hàn Việt Vietjet
Vé máy bay từ Đài Loan về Việt Nam
giá khách sạn cách ly