Dark Mode
Image

Cassandra READ Data

SELECT command is used to read data from Cassandra table. You can use this command to read a whole table, a single column, a particular cell etc.

Syntax:

SELECT FROM    

Example:

Polymorphism in Java | Dynamic Method Dispatch

Let's take an example to demonstrate how to read data from Cassandra table. We have a table named "student" with columns (student_id, student_fees student_name)


Read the whole table using SELECT command

SELECT * FROM student;  

Cassandra Read date 1


Read Particular Columns

This example will read only student_name and student_id from the student table.

SELECT student_id, student_name FROM student;   

Cassandra Read date 2


Use of WHERE Clause

WHERE clause is used with SELECT command to specify the exact location from where we have to fetch data.

Syntax:

SELECT FROM 

 WHERE ;   

Note: WHERE clause can be used only on the columns that are a part of primary key or have a secondary index on them.

Example:

SELECT * FROM student WHERE student_id=2;  

Cassandra Read date 3

Comment / Reply From