Apache Cassandra™ 1.2

Inserting rows and columns

You can use the SET command to insert columns for a particular row key into the users table. You can only set one column at a time in a SET command.

The Cassandra CLI sets the consistency level for the client. The level defaults to ONE for all write and read operations.

Procedure

  1. Set each of the columns for user bobbyjo, which is the row key.
    [default@demo] SET users['bobbyjo']['full_name']='Robert Jones';
    
    [default@demo] SET users['bobbyjo']['email']='bobjones@gmail.com';
    
    [default@demo] SET users['bobbyjo']['state']='TX';
    
    [default@demo] SET users['bobbyjo']['gender']='M';
    
    [default@demo] SET users['bobbyjo']['birth_year']='1975';    
                        
                    
  2. Set each of the columns for the row having the key yomama.
    [default@demo] SET users['yomama']['full_name']='Cathy Smith';
    
    [default@demo] SET users['yomama']['state']='CA';
    
    [default@demo] SET users['yomama']['gender']='F';
    
    [default@demo] SET users['yomama']['birth_year']='1969';
    
                    
                
  3. Creating an entry in the blog_entry table for row key yomama:
    [default@demo] SET blog_entry['yomama'][timeuuid()] = 'I love my new shoes!';
    
               
Show/hide