I have a table for my products in Cassandra. In this table I store the product name and seller name (there may be thousands of sellers) and score (Product score of the seller) so as following
CREATE TABLE products ( product_name varchar, seller_name varchar, score int, primary key (product_name, seller_name) );
I need to update score in my code
UPDATE products SET score = 2 WHERE product_name = "iphone-7" AND seller_name = "jack" ;
Everything is fine, except for Select Query:
SELECT * FROM products WHERE product_name = "iphone-7" ORDER BY SCORE DESC;
I need to get products by score order But as you know, it is not possible to sort without score being the primary key But if I put the score in the primary key, it will be not possible to update it what’s the solution?