Comparing Cassandra structure with Relational Databases
<p>A few days ago I read about wide-column stored type of NoSQL and
exclusively Apache-Cassandra.</p>
<p>What I understand is that  Cassandra consist of:</p>
<p>A keyspace(like database in relational databases) and supporting many column families or tables (Same as table in relational databases) and unlimited rows.</p>
<p>From Stackoverflow tags:</p>
<blockquote>
<p>A wide column store is a type of key-value database. It uses tables, rows, and columns, but unlike a relational database, the names and format of the columns can vary from row to row in the same table.</p>
</blockquote>
<p>In Cassandra all of the rows (in a table) should have a row key then each row key can have multiple columns.
I read about differences in implementation and storing data of Relational database and NoSQL (Cassandra).</p>
<p>But I don't understand the difference between structure:</p>
<p>Imagine a scenario which I have a table (or column family in Cassandra):</p>
<p>When I execute a query (CQL) like this :</p>
<pre><code>select * from users;
</code></pre>
<p>It gives me the result as you can see :</p>
<pre><code>lastname  | age  | city          | email               
----------+------+---------------+----------------------
      Doe |   36 | Beverly Hills | janedoe@email.com       
    Jones |   35 |        Austin | bob@example.com        
    Byrne |   24 |     San Diego | robbyrne@email.com         
    Smith |   46 |    Sacramento | null                    
   Jones2 | null |        Austin | bob@example.com       
</code></pre>
<p>So I perform the above scenario in relational database (MS SQL) with the following query:</p>
<pre><code>select * from [users] 
</code></pre>
<p>And the result is:</p>
<pre><code>lastname  | age  | city          | email               
----------+------+---------------+----------------------
      Doe |   36 | Beverly Hills | janedoe@email.com       
    Jones |   35 |        Austin | bob@example.com        
    Byrne |   24 |     San Diego | robbyrne@email.com         
    Smith |   46 |    Sacramento | NULL                    
   Jones2 | NULL |        Austin | bob@example.com       
</code></pre>
<p>I know that Cassandra supports dynamic column and I can perform this by using sth like:</p>
<pre><code>ALTER TABLE users ADD website varchar;
</code></pre>
<p>But it is available in relational model for example in mssql the above code can be implemented too. Something like:</p>
<pre><code>ALTER TABLE users ADD website varchar(MAX);
</code></pre>
<p>What I see is that the first select and second select result is the same.
In Cassandra , they just give a row key (lastname) as a standalone object but it is same as a unique field (like ID or a text) in mssql (and all relational databases) and I see the type of column in Cassandra is static (in my example <code>varchar</code>) unlike what it describes in Stackoverflow tag.</p>
<p>So my questions is:</p>
<ol>
<li><p>Is there any misunderstanding in my imagination about Cassandra?!</p>
</li>
<li><p>So what is different between two structure ?! I show you the result is same.</p>
</li>
<li><p>Is there any special scenarios (JSON like) that cannot be implemented in relational databases but Cassandra supports? (For example I know that nested column doesn't support in Cassandra.)</p>
</li>
</ol>
<p>Thank you for reading.</p>