To read data from a table in Cassandra, the SELECT command is used.
Syntax 1:
SELECT FROM <table_name> |
Syntax 2: Using WHERE clause.
SELECT FROM <table name> WHERE <condition>; |
Example 1:
SELECT * FROM employees; |
Output:
id name salary 1 Adi 50000 2 Bruno 30000 3 Chris 60000 4 Davis 20000 5 Eliza 15000
Example 2:
SELECT id, name FROM employees; |
Output:
id name 1 Adi 2 Bruno 3 Chris 4 Davis 5 Eliza
Example 3:
SELECT * FROM employees WHERE id=3; |
Output:
id name salary 3 Chris 60000