Database Reference
In-Depth Information
5.
We can also query the
users
table to fetch rows for multiple user ids
sorted by tweet date as follows (see
Figure 3-6
):
select * from users where user_id
in('imvivek','jhassell') order by tweet_date
DESC;
Figure 3-6
shows rows sorted by tweet_date for users imvivek
and jhassel.
Figure 3-6
.
Here we are retrieving rows for user_id imvivek and jhassel using the in clause
6.
Let's update a few rows for
followers
and explore how the data struc-
ture would look internally:
update users set followers = {'jhassell'}
where user_id='imvivek' and tweet_date =
'2013-12-31' and first_name = 'vivek';
update users set followers = {'jhassell'}
where user_id='imvivek' and tweet_date =
'2014-01-01' and first_name = 'vivek';
Here, the
user_id
will be a partition key and the rest of the columns
tweet_date
and
first_name
will be part of a clustering key. Let's try to look on
stored data with the help of
Figure 3-7
.