Dark Mode
Image

Cassandra Create Data

INSERT command is used to insert data into the columns of the table.

Syntax:

  1. INSERT INTO <tablename>  
  2. (<column1 name>, <column2 name>....)  
  3. VALUES (<value1>, <value2>....)  
  4. USING <option>   

Example:

Polymorphism in Java | Dynamic Method Dispatch

We have a table named "student" with columns (student_id, student_fees student_name,) and need to insert some data in student table.

Cassandra Create data 1

student_id student_fees student_name
1 5000 ajeet
2 3000 kanchan
3 2000 shivani

Let's see the code to insert data in student table.

  1. INSERT INTO student (student_id, student_fees, student_name)   
  2. VALUES(1,5000, 'Ajeet');  
  3. INSERT INTO student (student_id, student_fees, student_name)   
  4. VALUES(2,3000, 'Kanchan');  
  5. INSERT INTO student (student_id, student_fees, student_name)   
  6. VALUES(3, 2000, 'Shivani');  

Cassandra Create data 2

Now the data is inserted. You can use SELECT command to verify whether data is inserted or not.

  1. SELECT * FROM student;   

Output:

Cassandra Create data 3

Comment / Reply From