Aimma Butt - 038 Assignment 2
Aimma Butt - 038 Assignment 2
INTERNET OF THINGS
Assignment 2
Registration # 2020-BSE-038
Semester: VII - B
Question 1
What is “NoSQL” databases? Discuss their 4 types. Moreover, take a use case for each type of
database and provide the complete structure in form of supporting figures and functioning.
Discuss different parts of each type in detail.
NoSQL Databases
NoSQL databases means “Non-Relational” or “Non-SQL” databases which generally means that
the databases not only support SQL queries but also offer additional functionalities. It is the
category of databases that diverge the traditional relational database from the non-relation database
system. These NoSQL databases are used to handle large amount of unstructured, semi-structured
along with the structured datasets for the ease of development, functionality, and performance at
scale.
Following are the strong points of NoSQL Databases;
1. Flexibility: For faster and more iterative developments flexible schemas are provided.
This makes the datasets ideal for semi-structured and unstructured data.
2. Scalability: Rather of scaling up by adding expensive and powerful servers, NoSQL
databases are typically built to expand out using distributed hardware clusters.
3. Highly Functional: NoSQL databases offer exceptionally functional data types and APIs
that are specifically designed for each of their individual data models.
NoSQL and SQL databases selection depends on the specific requirements of the application,
including the nature of data, scalability, and performance with specific technology.
Example
A book record is stored as a JSON document. For each book, the item, Book Title, Edition,
Number, Author Name, Author ID are stored as attributes in a single document.
Key-Value Stores
Document Stores
Column Stores
Graph Stores
2|Page
1. Key-Value Stores
One of the simplest type of NoSQL databases are key-value stores. The data is stored in
the form of key-value pairs in which each key is unique and each key maps to the specific
value. This type of NoSQL databases is fast with efficient for basic operations such as read,
write, and delete for session management.
Advantages:
➢ Scalability
➢ High performance
➢ Developer productivity (easier to iterate while writing code)
➢ Simplicity
Disadvantages:
➢ Less optimization storage and query optimization
➢ Messy schemas
➢ Limited data connections and relationships
Examples:
Redis, Riak, SynamoDB
Structure:
.makefile
{
Key: ISBN: 12345
Value: {
“Book Title”: “ABC”,
“Edition”: “DEF”,
“Number”: “12345”,
“Author Name”: “XYZ”,
“Author ID”: “111”
}
}
3|Page
2. Document Stores:
The data stored in document stores databases are in the form of documents using formats
JSON and BSON. Each document contains key-value pairs, and documents can be grouped
into collections.
The document-store databases allows multiple data structures in the same collection that is
helpful in real0time applications, and content management.
Advantages:
➢ Powerful querying
➢ Scheme evolution
➢ Flexible databases
Disadvantages:
➢ Storage issues
➢ Increased complexity
Examples:
MongoDB, CouchDB, Couchbase
Structure:
.json
{
“Book Title”: “ABC”,
“Edition”: “DEF”,
“Number”: “12345”,
“Author Name”: “XYZ”,
“Author ID”: “111”
}
4|Page
3. Column Stores:
The databases of column store types are used to organize data into columns and column
families. It may vary between different rows within same family.
Column Stores databases are efficient for storing and retrieving large datasets. They help
us in fast data retrieval based on columns for data analytics and warehousing.
Advantages:
➢ Scalability
➢ Efficient for time-series data
➢ Flexible data model
Disadvantages:
➢ Complex data models
➢ Complex managing and optimization of columns
➢ Limited queries
Examples:
Apache Cassandra, HBase, ScyllaDB
Structure:
.mathematica{
Column Family: BookCatalog
Row: ISBN: 12345
Columns:
- Title: “ABC”
- Edition: “DEF”
- Number: “12345”
- AuthorName: “XYZ”
- AuthorID: “111”
}
5|Page
4. Graph Stores:
The databases like graph stores focus on complex relationship and connections between
data. The data is represented as nodes, edges and properties.
Graph databases are optimal for applications having high interconnected data like fraud
detection and recommender systems. They are performant for traversing connections
between entities.
Advantages:
➢ Handling connections
➢ Graph algorithms
➢ Performance for connected data
Disadvantages:
➢ Limited use cases
➢ Storge issues
Examples:
Neo4j, Amazon Neptune, ArangoDB
Structure:
.css
{
Node: Book
{
Title: “ABC”,
Edition: “DEF”,
Number: “12345”
}
Node: Author
{
Name: “XYZ”
6|Page
AuthorID: “111”
}
Relationship: AUTHOR_OF
(Author) - [:AUTHOR_OF] -> (Book)
}
7|Page