Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache Cassandra Essentials

You're reading from   Apache Cassandra Essentials Create your own massively scalable Cassandra database with highly responsive database queries

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher Packt
ISBN-13 9781783989102
Length 172 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Nitin Padalia Nitin Padalia
Author Profile Icon Nitin Padalia
Nitin Padalia
Arrow right icon
View More author details
Toc

Data types


Cassandra has five categories or data types:

  1. Native types: These are built-in types in Cassandra. For each type there is a keyword to define.

  2. Collection types: These types can store a group of native type elements. There are three categories—set, list, and map.

  3. Tuple types: Tuple types can store a fixed length group of elements in a column similar to user-defined types, except that the tuple element field has no names. Hence, the ordering should be the same as during inserting a record in the order they are defined at table creation time. The following is an example of creating a column family with a tuple type:

    CREATE TABLE user_reviews (
    useriduuid PRIMARY KEY,
    review frozen<tuple<text, text, decimal>>
    )
    INSERT INTO user_reviews (userid, review ) VALUES ( 9b02528d-75af-41d9-866e-75d189f57118, ('awesome', 'This App is awesome', 4.8))
    // Below will raise error due to wrong insertion order
    INSERT INTO user_reviews (userid, review ) VALUES ( 9b02528d-75af-41d9-866e-75d189f57118...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image