CREATE TABLE users ( username text PRIMARY KEY, password text ); CREATE TABLE tweets ( tweet_id uuid PRIMARY KEY, username text, body text ); CREATE TABLE userline ( username text, time timeuuid, tweet_id uuid, PRIMARY KEY (username, time) ) WITH CLUSTERING ORDER BY (time DESC); CREATE TABLE timeline ( username text, time timeuuid, tweet_id uuid, PRIMARY KEY (username, time) ) WITH CLUSTERING ORDER BY (time DESC); SELECT * FROM timeline WHERE username=? LIMIT 100; CREATE TABLE friends ( username text, friend text, since timestamp, PRIMARY KEY (username, friend) ); CREATE TABLE followers ( username text, follower text, since timestamp, PRIMARY KEY (username, follower) ); INSERT INTO tweets (tweet_id, username, body) VALUES (?, ?, ?); INSERT INTO userline (username, time, tweet_id) VALUES (?, ?, ?); INSERT INTO timeline (username, time, tweet_id) VALUES (?, ?, ?); SELECT time, tweet_id FROM userline WHERE username=? LIMIT ?; SELECT * FROM tweets WHERE tweet_id=?; UPDATE users SET password = ? WHERE username = ?; SELECT follower FROM followers WHERE username=?; SELECT friend FROM friends WHERE username=?; DELETE FROM friends WHERE username=? AND friend=?; DELETE FROM followers WHERE username=? AND follower=?