Database Reference
In-Depth Information
.............+........................................+.................
foo@bar.com |
{756716f7-2e54-4715-9f00-91dcbea6cf50} | {'GOOG'}
DELETE tickers
FROM users
WHERE email = 'foo@bar.com';
email | portfoli-
os | tickers
.............+........................................+.................
foo@bar.com |
{756716f7-2e54-4715-9f00-91dcbea6cf50} | null
Lists
When uniqueness is not required, and maintaining order is required, Cassandra
lists come in handy. Let's say we want to allow our users to specify the top five
tickers from the previous example. Listing 3.10 shows an example of lists.
Listing 3.10 Example of Using Lists
Click here to view code image
ALTER TABLE users ADD top_tickers list<text>;
UPDATE users
SET top_tickers = ['GOOG']
WHERE email = 'foo@bar.com';
UPDATE users
SET top_tickers = top_tickers + ['AMZN']
WHERE email = 'foo@bar.com';
email
| portfolios
| tickers |
top_tickers
.............+.....................+.........+.................
foo@bar.com | {756716f7-2e54... } |
null |
['GOOG', 'AMZN']
UPDATE users
SET top_tickers[1] = 'FB'
WHERE email = 'foo@bar.com';
email
| portfolios
| tickers |
top_tickers
 
Search WWH ::




Custom Search