RDBMS Schema To NoSQL Cassandra

136 Views Asked by At

Let's go directly to the question: I've this RDBMS schema, that is a part of a large schema that I don't know. RDBMS Schema

Now, the request (it's a university project) is to think 5 queries and then build this schema in Cassandra and perform those queries via CQL.

Now.. I get that I don't have Join operation in Cassandra, so I kinda need to duplicate something, but I stil can't understand something important.

Let's say my first query is "Print all SalesOrderHeader (its ID and status) with OrderDate > 01/01/2017".. So, for this I will need a ColumnFamily for SalesOrderHeader and so I will write something like:

CREATE TABLE SalesOrderHeader {
    alesOrderID uuid PRIMARY KEY,
    RevisionNumber TEXT,
    OrderDate   TIMESTAMP,
    DueDate     TIMESTAMP,
    ShipDate    TIMESTAMP,
    Status      TEXT,
    OnlineOrderFlag BOOLEAN,
    SalesOrderNumber TEXT,
    PurchaseOrderNumber TEXT,
    AccountNumber TEXT,
    SubTotal FLOAT,
    TaxAmt  FLOAT,
    Freight TEXT,
    TotalDue    FLOAT,
    Comment     TEXT,
    CreditCartApprovalCode TEXT,
}

But now, what I don't understand is: should I add to this "TABLE" the information about the CreditCard?

I mean, let's say a second query ask me "Print all SalesOrderHader (id and status) made with a CreditCard of Type = VISA". CreditCard and SalesOrderHeader is a 1-To-1 Relation, so I could Think to put all the information about CreditCard into the TABLE SalesOrderHeader, but should I make two different TABLE of SalesOrderHeader, one with the CreditCard information and one without?

Unfortunately in classes we just saw what's Cassandra is, then they said "Ok, to this project and read the Cassandra Documentation".. Too bad I'm having lots of problem >_>

I searched on the internet but I just found some easier example with two table (like Song and Playlist) but they didn't really help me.

0

There are 0 best solutions below