Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning Apache Cassandra
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning Apache Cassandra

Learning Apache Cassandra

By : Brown
4.4 (13)
close
close
Learning Apache Cassandra

Learning Apache Cassandra

4.4 (13)
By: Brown

Overview of this book

If you're an application developer familiar with SQL databases such as MySQL or Postgres, and you want to explore distributed databases such as Cassandra, this is the perfect guide for you. Even if you've never worked with a distributed database before, Cassandra's intuitive programming interface coupled with the step-by-step examples in this book will have you building highly scalable persistence layers for your applications in no time.
Table of Contents (14 chapters)
close
close
13
Index

Unfollowing users


It's conceivable that bob may end up posting too many funny cat pictures for alice's taste, in which case, she may decide to unfollow him. For alice to do that, we'll need to remove the rows representing the follow relationship from both the inbound and outbound follow tables:

DELETE FROM "user_outbound_follows"
WHERE "follower_username" = 'alice'
  AND "followed_username" = 'bob';

DELETE FROM "user_inbound_follows"
WHERE "followed_username" = 'bob'
  AND "follower_username" = 'alice';

This is our first encounter with CQL's DELETE statement, although it should look quite familiar to anyone who's worked with SQL. To delete a row, we specify the full primary key of the row, which is to say both the partition key(s) and the clustering column(s). The WHERE…AND syntax is the same as that used in SELECT queries, introduced in Chapter 3, Organizing Related Data.

To check the effects of the deletion, we can query again for the list of users alice follows:

SELECT "followed_username...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY