NoSQL
Database:
Chapter 6b
The CRUD Operation in Mobile
Apps
@SKR4307
1. NoSQL – The basic
• Data organizing – a very difficult task
▪ Organise – categorizing stuff depending on its
type and function
▪ RDBMS – categorise data in the form of tables
(forming relationship between the tables)
• Query – questioning the database
▪ Gives a relevant answer in return
▪ SQL – querying language (e.g., select * from
employee_data)
▪ Relational databases – follow detailed blueprint
how tables work (called schema)
Schema / attributes
2. Tables schema and relationship
3. RDBMS – The problems
Networking applications • How does change the schema each time
(e.g., Amazon, Facebook, • Time consuming to devote time and
IG …) – release updates,
add new functionalities, labour to change the scheme
extra modules • SQL could not work
• Can not handle Data Variety
• Changing tables and relationships are
RDBMS cons difficult
• Follow the ACID properties (not
flexible)
3.1 RDMS vs NoSQL
• RDBMS – each extra column need all the
prior rows to have values for that column.
▪ Every entry should have same number of
columns
• NoSQL – can add a column to a specific
row partitions
▪ Each row can have a different number of
columns
▪ 104 has name only
▪ 103 has email, name, tel and tel2
3.2 NoSQL – BASE model
• Relies upon a softer model known as the BASE model.
▪ BASE (Basically Available, Soft state, Eventual consistency).
▪ Basically Available – Guarantees the availability of the data . There will be a
response to any request (can be failure too).
▪ Soft state – The state of the system could change over time.
▪ Eventual consistency – The system will eventually become consistent once it
stops receiving input.
3.3 NoSQL characteristics
• Schema free
• Eventually consistent (as in the BASE property)
• Replication of data stores to avoid Single Point of Failure
• Handling data variety and huge amounts of data
4. NoSQL database types/categories
1. Key value Stores — e.g., Riak,Voldemort, Redis
2. Wide Column Stores — e.g., Cassandra and HBase
3. Document databases — e.g., MongoDB
4. Graph databases — e.g., Neo4J and HyperGraphDB
Source:
4.1 Key-Value Stores
• Uses a hash table – exists a unique key and a pointer to a particular
item of data.
▪ E.g., a phone directory – names of the individual and their numbers are
mapped together.
• No default query language.
▪ Retrieve data using get, put, and delete commands – reason it has high
performance.
• Applications – Useful for storage of Comments and Session
information.
▪ E.g., Pinterest
4.2 Wide column stores
• Columns in each row are contained within that
row.
▪ Each column family is a container of rows in an RDBMS
table.
▪ The key identifies the row consisting of multiple columns.
• Rows do not need to have the same number of
columns.
▪ Columns can be added to any row at any time without
having to add it to other rows. It is a partitioned row store.
• Applications: Spotify uses Cassandra to store user
profile attributes and metadata.
Source:
4.3 Storing data in columnar database
• Table with 4 cols, 3 rows
• Row oriented
▪ 1, Saravanan, Nandhini, 8000; 2,
Varshini, Usha, 4000; 3, D, Shanti,
10000;
• Column oriented
▪ 1,2,3; Saravanan, Varshini, D;
Nandhini, Usha, Shanti; 8000, 4000,
10000;
4.4 Document Databases
• Uses JSON, XML, or BSON (binary encoding of JSON) documents
to store data.
• Like a key-value database, but a document store consists of semi-
structured data.
• A single document is to store records and its data.
• Does not support relations or joins.
• Application – SEGA uses MongoDB for handling 11 million in-
game accounts built on MongoDB.
▪ Two tables (Artists & Tracks)
▪ JSON tree structure
Source:
4.5 Graph databases
• Nodes and relationships are the essential constituents of graph
databases.
▪ A node represents an entity.
▪ A relationship represents how two nodes are associated.
• In RDBMS – adding another relation results in a lot of schema
changes.
• Graph database requires only storing data once (nodes).
▪ The different types of relationships (edges) are specified to the stored data.
▪ The relationships between the nodes are predetermined, that is, it is not
determined at query time.
Source: https://dzone.com/articles/a-comparison-of-sql-and-nosql-to-simplify-your-dat
https://shishirkumarblog.wordpress.com/technical/sql-vs-nosql-the-cap-theorem/
References
• The basics of NoSQL databases—and why we need them:
https://www.freecodecamp.org/news/nosql-databases-5f6639ed9574/
• Getting Acquainted with NoSQL on Windows Azure:
https://blogs.msdn.microsoft.com/usisvde/2012/04/05/getting-acquainted-with-nosql-on-
windows-azure/