Im new to Cassandra and try to understand the datamodel. so i know how to insert if "bob" is following "james". i also know how to query to get a list of all people who follow "bob" and i know how to query to get a list of who "bob" is following.
My Question is, given the below, what does the query look like if i would like to find out if "bob" is following "james" ? (Yes or No)
Is this the right query?
SELECT * FROM followers WHERE username="bob" AND following="james"
Do i need to set a second Index on FOLLOWING to be able to execute the above query?
-- User storage
CREATE TABLE users (username text PRIMARY KEY, password text);
-- Users user is following
CREATE TABLE following (
username text,
followed text,
PRIMARY KEY(username, followed)
);
-- Users who follow user
CREATE TABLE followers (
username text,
following text,
PRIMARY KEY(username, following)
);