Inserting data using CQL in DataStax Studio

Steps to add data to a table by writing and executing CQL code in notebook cells.

Prerequisites

To add data to a table from a cell in your notebook:

Procedure

  1. Use the CQL command INSERT to add data to the tables:
    USE inventory;
    
    INSERT INTO product_info (product_id, product_name) VALUES (99051fe9-6a9c-46c2-b949-38ef78858dd0,'Coffee mug');
    INSERT INTO product_info (product_id, product_name) VALUES (b3a76c6b-7c7f-4af6-964f-803a9283c401,'Ethiopian coffee');
    INSERT INTO product_info (product_id, product_name) VALUES (0c3f7e87-f6b6-41d2-9668-2b64d117102c,'Half and half');
    
    INSERT INTO buyer_info (buyer_id, buyer_name) VALUES (f5ca5394-f242-40d3-a8d1-9e36497feb5f,'Jane Doe');
    INSERT INTO buyer_info (buyer_id, buyer_name) VALUES (19af1261-4442-4c23-a34f-2a5b12edc923,'John Smith');
  2. To display the inserted data, use the CQL command SELECT:
    SELECT * FROM inventory.product_info;

What's next

The notebook tutorial Working with CQL is installed with Studio. For more information about DataStax Enterprise CQL, see Accessing data using CQL.