CREATE KEYSPACE testkeyspace WITH replication = {'class': 'SimpleStrategy', replication_factor:'1' } AND durable_write= 'true';
DESCRIBE KEYSPACES
USE testkeyspace;
CREATE TABLE employee_by_id (id int primary key, name text, position text);
DESCRIBE TABLES;
DROP TABLE employee_by_id;
CREATE TABLE empleoyee_by_carmake (car_make text, id int , car_model text, PRIMARY KEY (car_make, id)); Note: in the above query we create a composite query by addding the partition key (car_make ) and primary key
CREATE TABLE employee_by_carmake_sorted (car_make text, age int. name text, PRIMARY KEY (car_make, age, id));
INSERT INTO employee_bu_uuid VALUES (now(), 'tom','jerry');
CREATE TABLE purchase_by_customer_id (id uuid PRIMARY KEY, purchases counter);
UPDATE purchase_bu_customer_id SET purchase = purchase + 1 WHERE id = uudi());
CREATE MATERIALIZED VIEW test_keyspace.employee_by_department AS SELECT * FROM test_keyspace.employee_by_car_make WHERE department_id IS NOT NULL, car_make IS NOT NULL, car_model IS NOT NULL, id IS NOT NULL PRIMARY KEY (department_id, car_make, car_model, id); // this will create materialized view -> without creating extra table, that can be queried using department_id