Introduction to NoSQL Databases

 

  • NoSQL in detail
  • Why NoSQL
  • Types of NoSQL
  • MongoDB
  • Demo - Using NoSQL

 

  • NoSQL is Not only SQL , Carlo Strozzi used the term NoSQL to name his leightweight open-source relational database in 1998.                                                                                                          
  • A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.                                                                                                                                  
  •  Non-Relational, distributed, open-source and horizantally scalable.                                                                                                                    
  • NoSQL encompasses a wide variety of different database technologies that were developed in response to a rise in the volume of data stored about users, objects and products, the frequency in which this data is accessed, and performance and processing needs.                                                                                                   
  •  NoSQL designed to cope with the scale and agility challenges that face modern applications, nor were they built to take advantage of the cheap storage.

 

  • MongoDB
  • Redis
  • Cassandra
  • CouchDB
  • Hbase

Some Open-Source NoSQL's

Why NoSQL ?

  • Large volumes structured, semi-structured and unstructured data.
  • Agile sprints, quick  iteration, Frequent code pushes
  • Dynamic Schemas
  • Auto-Sharding

 

 

 

  • NoSQL technology was pioneered by leading internet companies — including Google, Facebook, Amazon, and LinkedIn — to overcome the limitations of 40-year-old relational database technology for use with modern web applications.
  • Today, enterprises are adopting NoSQL for a growing number of uses cases, a choice that is driven by four interrelated megatrends: Big Users, Big Data, the Internet of Things, and Cloud Computing.
  • Relational and NoSQL data models are very different. The relational model takes data and separates it into many interrelated tables that contain rows and columns. Tables reference each other through foreign keys that are stored in columns as well                                                                                                                          
  • When looking up data, the desired information has to be collected from many tables (often hundreds in today’s enterprise applications) and combined before it can be provided to the application. Similarly, when writing data, the write needs to be coordinated and performed on many tables.                                                                                                                                                     
  • NoSQL databases have a very different model. For example, a document-oriented NoSQL database takes the data you want to store and aggregates it into documents using the JSON format.                                                                                                          
  • Each JSON document can be thought of as an object used by your application
  • Another major difference is that relational technologies have rigid schemas while NoSQL models are schemaless.                                                                                                                                                                                  
  • Relational technology requires strict definition of a schema prior to storing any data into a database. Changing the schema once data is inserted is extremely disruptive and frequently avoided, which is a problem in the Big Data era when application developers need to constantly and rapidly incorporate new types of data to enrich their apps.                                                                                                                                        
  • In comparison, document databases are schemaless, allowing you to freely add fields to JSON documents without having to first define changes. The format of the data being inserted can be changed at any time, without application disruption.

Types of NoSQL

  • Document databases : MongoDB, CouchDB 
  • Graph stores : BigData, HyperGraphDB
  • Key-value stores : Redis , Riak
  • Wide-column stores : Hbase, Vertica

MongoDB

  • MongoDB stores data using flexible documents.
  • Document may contain arrays.
  • Group of Documents called as Collections.

 

 "_id" : ObjectId("54b67bd7bb84d43de316ed2a"), "name" : "Manoj", "place" : "Palakkad" }

 

 "_id" : ObjectId("54b67bd7bb84d43de316ed2a"), "name" : "Manoj", "place" : "Palakkad" , Technologies: ['Ruby','Rails','Js']}

 

{
   _id: "joe",
   name: "Joe Bookreader",
   addresses: [
                {
                  street: "123 Fake Street",
                  city: "Faketon",
                  state: "MA",
                  zip: "12345"
                },
                {
                  street: "1 Some Other Street",
                  city: "Boston",
                  state: "MA",
                  zip: "12345"
                }
              ]
 }


 INSERT INTO CONTACTS (NAME, PHONE_NUMBER) VALUES('RICK HIGHTOWER','520-555-1212')
 db.contacts.insert({name:'RICK HIGHTOWER',phoneNumber:'520-555-1212'})

 

 select * from contacts

db.contacts.find()

Questions ?

Introduction to NoSQL Databases

By Manoj Menon

Introduction to NoSQL Databases

  • 327