Question: Design a Cassandra database to support the application described in the previous problem. Here's the designed database. create table user ( Email varchar2(100), username varchar2(100),

 Design a Cassandra database to support the application described in the

Design a Cassandra database to support the application described in the previous problem.

Here's the designed database.

create table user ( Email varchar2(100), username varchar2(100), country varchar2(100), age number, action varchar2(100), playlistid number, PRIMARY KEY (username), CONSTRAINT FK_PlaylistId FOREIGN KEY (playlistid) REFERENCES Playlist(playlistid) ) // action column in user table shows whether user plays, creates or shares music

create table Playlist( playlistid number, playlistname varchar(100), tags varchar2(100), PRIMARY KEY (playlistid) )

create table songs ( playlistid number, title varchar2(100), duration number, songid number, albumid number, PRIMARY KEY (songid), CONSTRAINT FK_PlaylistId1 FOREIGN KEY (playlistid) REFERENCES Playlist(playlistid), CONSTRAINT FK_Albumid FOREIGN KEY (albumid) REFERENCES album(albumid) )

create table album( title varchar2(100), year number, albumid number, format varchar2(10), genre varchar2(100), artistid number, PRIMARY KEY (albumid), CONSTRAINT FK_ArtistId FOREIGN KEY (artistid) REFERENCES artist(artistid) )

create table artist( style varchar2(100), name varchar2(100), country varchar2(100), artistid number, PRIMARY KEY (artistid) )

The following are the access patterns: Q1. Find albums by a given performer. Order results by year (DESC). Q2. Find albums by genre released after a given year. Order results by year (DESC). Q3. Find albums of a given genre released in a given country after a given year. Order results by year (DESC). Q4. Find playlists by a given album. Q5. Find a user who created a given playlist. Q6. Find users who shared a given playlist. First, based on the above access patterns, design a logical data model. Then, for every table, assign datatypes to each column to obtain a physical data model. For this exercise, you do not need to perform other physical optimizations. Your answer should include CREATE table statements in the CQL language that represent your Cassandra database schema.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!