How to Limit returned rows in Cassandra Query Language
You can use LIMIT option in query to control the number of rows you want to get.
Syntax:
column2,
...FROM tablename LIMIT numberofrow;
Example:
Let's create employee table by using below CQL Statement.
(
employeeid INT ,
fname TEXT,
lname TEXT,
address TEXT,
age TINYINT,
PRIMARY KEY((employeeid,fname),lname)
)
WITH clustering
ORDER BY (
lname DESC);
Insert sample data by using CQL insert statement
(employeeid,fname,lname,address,age)
VALUES (1,'John','Doe','ABC Address',23);
INSERT INTO employee
(employeeid,fname,lname,address,age)
VALUES (2,'Robert','Ladson',' Address',40);
INSERT INTO employee
(employeeid,fname,lname,address,age)
VALUES (3,'M','Raza','New Address',38);
INSERT INTO employee
(employeeid,fname,lname,address,age)
VALUES (3,'M','Ali','New Address',38);
Now if we want to get only 2 records then we can use below statement. Cassandra is going to return first 2 records.
FROM employee LIMIT 2;
Output
employeeid | fname | lname | address | age
------------+-------+-------+-------------+-----
3 | M | Raza | New Address | 38
3 | M | Ali | New Address | 38
Liên hệ Aivivu, đặt vé máy bay tham khảo
ReplyDeleteve may bay di my gia re
đặt vé máy bay từ vinh đi sài gòn
vé máy bay sài gòn hà nội tháng 8
vé máy bay từ tphcm đi nha trang
vé máy bay đi huế giá rẻ
taxi sân bay nội bài giá rẻ
combo đà nẵng giá rẻ