Reading Data From Cassandra Table

Author: Al-mamun Sarkar Date: 2020-09-20 07:36:12

The SELECT command is used to read data and the WHERE command is used to adding a condition on the SELECT statement.

 

Select all data from a table: 

Syntax:

SELECT * FROM table_name;

Example:

SELECT * FROM employees;

 

Select selected column data from a table: 

Syntax:

SELECT column1, column2, .... 
FROM table_name;

Example:

SELECT city, name
FROM employees;

 

Adding Condition on the SELECT statement: 

Syntax:

SELECT column1, column2, .... 
FROM table_name
WHERE condition;

Example:

SELECT city, name
FROM employees
WHERE id = 2;

 

Allow Filtering:

SELECT * FROM employees WHERE id > 2 ALLOW FILTERING;

Using ALLOW FILTERING is very bad for performance. So we should try to avoid using ALLOW FILTERING.