You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deleting Based on Partition Keys (Without Clustering Columns)
-- Delete all users with a specific user_idDELETEFROM users WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
-- Delete all products in the 'Electronics' categoryDELETEFROM products WHERE category ='Electronics';
-- Delete all orders for a specific userDELETEFROM orders WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
-- Delete all notifications for a user_idDELETEFROM notifications WHERE user_id =1;
Deleting Specific Rows Based on Primary Keys (Including Clustering Columns)
-- Delete a specific userDELETEFROM users WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
-- Delete a specific product in the Electronics categoryDELETEFROM products WHERE category ='Electronics'AND product_id = 123e4567-e89b-12d3-a456-426614174001;
-- Delete an order for a specific user on a specific dateDELETEFROM orders WHERE user_id = 123e4567-e89b-12d3-a456-426614174000AND order_date ='2024-11-03 12:00:00';
-- Delete a specific notification for a user at a specific timeDELETEFROM notifications WHERE user_id =1AND post_date ='2024-11-01 10:00:00';
Deleting Specific Columns
-- Delete the 'age' column for a specific user in the Users tableDELETE age FROM users WHERE user_id = 123e4567-e89b-12d3-a456-426614174000[5];
-- Delete the 'price' column for a specific product in the Electronics categoryDELETE price FROM products WHERE category ='Electronics'AND product_id = 123e4567-e89b-12d3-a456-426614174001[5];
-- Delete the 'total' column for a specific orderDELETE total FROM orders WHERE user_id = 123e4567-e89b-12d3-a456-426614174000AND order_id = 50554d6e-29bb-11e5-b345-feff819cdc9f[5];
-- Delete the 'notification_type' column for a specific notificationDELETE notification_type FROM notifications WHERE user_id =1AND post_date ='2024-11-01 10:00:00';
The text was updated successfully, but these errors were encountered:
This should be done after #539 but is a lot simpler.
https://cassandra.apache.org/doc/latest/cassandra/developing/cql/dml.html#delete_statement
The main points are:
Here are several examples of DELETE statements in Cassandra for different scenarios:
Examples
Deleting Based on Partition Keys (Without Clustering Columns)
Deleting Specific Rows Based on Primary Keys (Including Clustering Columns)
Deleting Specific Columns
The text was updated successfully, but these errors were encountered: