Question : Cassandra database tables always be in rd normal form? 1. True 2. False
Correct Answer : Get Lastest Questions and Answer : Explanation: JOIN is not efficient, especially one of these tables are very big. Hence, it is always preferred data to be de-normalized in Cassandra world, to have lowest latency.
Question : You have been given below structure of data, with Cassandra datatypes
course_id timeuuid published_date timestamp category set title text trainer text
Following are the table structure
CREATE TABLE HadoopExam ( course_id timeuuid, published_date timestamp, category set, title text, trainer text PRIMARY KEY ( XXXX ) ) WITH CLUSTERING ORDER BY ( YYYYY);
Now replace the correct value of XXXX and YYYY, to satisfy the below requirement
Retrieve course a trainer has created in (newest first).
1. XXXX=((trainer), published_date, course_id) and YYYY= published_date DESC ,course_id ASC
2. XXXX=((course_id), published_date, trainer) and YYYY= trainer DESC ,course_id ASC
Retrieve course a trainer has created in (newest first).
Retrieve Course Created by Trainer Order by newest first
Our criteria is created by trainer. Hence, certainly it would be partition key. We need order by newest first hence, we need to cluster based on published_date
Hence, our primary key can be ((trainer), published_date). But as we can check these are not unique. Hence, we need to define uniqueness, so add course_id in primary key ((trainer), published_date, course_id)
Question : You have been given below table definition
CREATE TABLE books_by_category ( category text, published_date timestamp, book_id timeuuid, title text, PRIMARY KEY ( XXXX) ) WITH CLUSTERING ORDER BY (YYYY );
Now fill in the values in XXXX and YYYY , which satisfies the below query requirement
Retrieve books within a particular category (newest fist). 1. XXXX= ((category), book_id, published_date ) and YYYY=published_date DESC , book_id ASC