Database Reference
In-Depth Information
( 1, 'Washington', 'Seattle University', 'Nick Jonas');
# So far so good
SELECT * FROM static_col;
id | city | university | name
----+------------+-----------------------+--------------
1 | Seattle | Seattle University | Barry Kriple
1 | Washington | Seattle University | Nick Jonas
2 | Washington | Washington University | Rose Byrne
(3 rows)
# Just insert another record to id=1 with a different
university name
INSERT INTO static_col (id, city, university, name ) VALUES
( 1, 'New York', 'Coursera', 'John Hacker Doe');
# All the records in that row key are updated
cqlsh:demo_cql> SELECT * FROM static_col;
id | city | university | name
----+------------+-----------------------+-----------------
1 | New York | Coursera | John Hacker Doe
1 | Seattle | Coursera | Barry Kriple
1 | Washington | Coursera | Nick Jonas
2 | Washington | Washington University | Rose Byrne
(4 rows)
The static column can be useful when you want to store a common global record of a
column across all the records that share the same row key. It can be thought of as a static
variable in Java, which is shared among all the instances of the class. An application of
such a case could be a game where you are given initial credit coins, and you can use
Search WWH ::




Custom Search