≡ Menu

SQL vs NoSQL Database Differences Explained with few Example DB

Most of you are already familiar with SQL database, and have a good knowledge on either MySQL, Oracle, or other SQL databases. In the last several years, NoSQL database is getting widely adopted to solve various business problems.

It is helpful to understand the difference between SQL and NoSQL database, and some of available NoSQL database that you can play around with.

SQL vs NoSQL: High-Level Differences

  • SQL databases are primarily called as Relational Databases (RDBMS); whereas NoSQL database are primarily called as non-relational or distributed database.
  • SQL databases are table based databases whereas NoSQL databases are document based, key-value pairs, graph databases or wide-column stores. This means that SQL databases represent data in form of tables which consists of n number of rows of data whereas NoSQL databases are the collection of key-value pair, documents, graph databases or wide-column stores which do not have standard schema definitions which it needs to adhered to.
  • SQL databases have predefined schema whereas NoSQL databases have dynamic schema for unstructured data.
  • SQL databases are vertically scalable whereas the NoSQL databases are horizontally scalable. SQL databases are scaled by increasing the horse-power of the hardware. NoSQL databases are scaled by increasing the databases servers in the pool of resources to reduce the load.
  • SQL databases uses SQL ( structured query language ) for defining and manipulating the data, which is very powerful. In NoSQL database, queries are focused on collection of documents. Sometimes it is also called as UnQL (Unstructured Query Language). The syntax of using UnQL varies from database to database.
  • SQL database examples: MySql, Oracle, Sqlite, Postgres and MS-SQL. NoSQL database examples: MongoDB, BigTable, Redis, RavenDb, Cassandra, Hbase, Neo4j and CouchDb
  • For complex queries: SQL databases are good fit for the complex query intensive environment whereas NoSQL databases are not good fit for complex queries. On a high-level, NoSQL don’t have standard interfaces to perform complex queries, and the queries themselves in NoSQL are not as powerful as SQL query language.
  • For the type of data to be stored: SQL databases are not best fit for hierarchical data storage. But, NoSQL database fits better for the hierarchical data storage as it follows the key-value pair way of storing data similar to JSON data. NoSQL database are highly preferred for large data set (i.e for big data). Hbase is an example for this purpose.
  • For scalability: In most typical situations, SQL databases are vertically scalable. You can manage increasing load by increasing the CPU, RAM, SSD, etc, on a single server. On the other hand, NoSQL databases are horizontally scalable. You can just add few more servers easily in your NoSQL database infrastructure to handle the large traffic.
  • For high transactional based application: SQL databases are best fit for heavy duty transactional type applications, as it is more stable and promises the atomicity as well as integrity of the data. While you can use NoSQL for transactions purpose, it is still not comparable and sable enough in high load and for complex transactional applications.
  • For support: Excellent support are available for all SQL database from their vendors. There are also lot of independent consultations who can help you with SQL database for a very large scale deployments. For some NoSQL database you still have to rely on community support, and only limited outside experts are available for you to setup and deploy your large scale NoSQL deployments.
  • For properties: SQL databases emphasizes on ACID properties ( Atomicity, Consistency, Isolation and Durability) whereas the NoSQL database follows the Brewers CAP theorem ( Consistency, Availability and Partition tolerance )
  • For DB types: On a high-level, we can classify SQL databases as either open-source or close-sourced from commercial vendors. NoSQL databases can be classified on the basis of way of storing data as graph databases, key-value store databases, document store databases, column store database and XML databases.

SQL Database Examples

1. MySQL Community Edition

MySQL database is very popular open-source database. It is generally been stacked with apache and PHP, although it can be also stacked with nginx and server side javascripting using Node js. The following are some of MySQL benefits and strengths:

  • Replication: By replicating MySQL database across multiple nodes the work load can be reduced heavily increasing the scalability and availability of business application
  • Sharding: MySQL sharding os useful when there is large no of write operations in a high traffic website. By sharding MySQL servers, the application is partitioned into multiple servers dividing the database into small chunks. As low cost servers can be deployed for this purpose, this is cost effective.
  • Memcached as a NoSQL API to MySQL: Memcached can be used to increase the performance of the data retrieval operations giving an advantage of NoSQL api to MySQL server.
  • Maturity: This database has been around for a long time and tremendous community input and testing has gone into this database making it very stable.
  • Wide range of Platforms and Languages: MySql is available for all major platforms like Linux, Windows, Mac, BSD and Solaris. It also has connectors to languages like Node.js, Ruby, C#, C++, C, Java, Perl, PHP and Python.
  • Cost effectiveness: It is open source and free.

2. MS-SQL Server Express Edition

It is a powerful and user friendly database which has good stability, reliability and scalability with support from Microsoft. The following are some of MS-SQL benefits and strengths:

  • Integrated Development Environment: Microsoft visual studio, Sql Server Management Studio and Visual Developer tools provide a very helpful way for development and increase the developers productivity.
  • Disaster Recovery: It has good disaster recovery mechanism including database mirroring, fail over clustering and RAID partitioning.
  • Cloud back-up: Microsoft also provides cloud storage when you perform a cloud-backup of your database

3. Oracle Express Edition

It is a limited edition of Oracle Enterprise Edition server with certain limitations. This database is free for development and deployment. The following are some of Oracle benefits and strengths:

  • Easy to Upgrade: Can be easily upgraded to newer version, or to an enterprise edition.
  • Wide platform support: It supports a wide range of platforms including Linux and Windows
  • Scalability: Although the scalability of this database is not cost effective as MySQL server, but the solution is very reliable, secure, easily manageable and productive.

NoSQL Database Examples

1. MongoDB

Mongodb is one of the most popular document based NoSQL database as it stores data in JSON like documents. It is non-relational database with dynamic schema. It has been developed by the founders of DoubleClick, written in C++ and is currently being used by some big companies like The New York Times, Craigslist, MTV Networks. The following are some of MongoDB benefits and strengths:

  • Speed: For simple queries, it gives good performance, as all the related data are in single document which eliminates the join operations.
  • Scalability: It is horizontally scalable i.e. you can reduce the workload by increasing the number of servers in your resource pool instead of relying on a stand alone resource.
  • Manageable: It is easy to use for both developers and administrators. This also gives the ability to shard database
  • Dynamic Schema: Its gives you the flexibility to evolve your data schema without modifying the existing data

2. CouchDB

CouchDB is also a document based NoSQL database. It stores data in form of JSON documents. The following are some of CouchDB benefits and strengths:

  • Schema-less: As a member of NoSQL family, it also have dynamic schema which makes it more flexible, having a form of JSON documents for storing data.
  • HTTP query: You can access your database documents using your web browser.
  • Conflict Resolution: It has automatic conflict detection which is useful while in a distributed database.
  • Easy Replication: Implementing replication is fairly straight forward

3. Redis

Redis is another Open Source NoSQL database which is mainly used because of its lightening speed. It is written in ANSI C language. The following are some of Redis benefits and strengths:

  • Data structures: Redis provides efficient data structures to an extend that it is sometimes called as data structure server. The keys stored in database can be hashes, lists, strings, sorted or unsorted sets.
  • Redis as Cache: You can use Redis as a cache by implementing keys with limited time to live to improve the performance.
  • Very fast: It is consider as one of the fastest NoSQL server as it works with the in-memory dataset.
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Jalal Hajigholamali January 15, 2014, 2:06 am

    Hi,
    Very useful article..
    Thanks.

  • Mohankumar January 15, 2014, 3:20 am

    Hi, thank you very much for this article…i was waiting for this…

  • Dan MC January 15, 2014, 3:40 am

    It can also be added that NoSQL databases tend to represent entities in a more natural way.
    Normalization rules for relational databases often break entities in an artificial way in order to avoid redundancy (which is something NoSQL databases don’t care too much about). Thus, relational databases end up, more often than not, with objects that are not good representations of the real world. NoSQL databases do a better job at representing real world objects.
    It’s all fresh in my mind, I had my exam on Advanced DataBases just yesterday and thus was one of the questions!!

  • Tarun Trehan January 15, 2014, 4:53 am

    Hi,
    Nice article in a very concise and apt form.
    May be, we can include some real life examples of projects that fall under which umbrella.

  • Bhagyaraj January 15, 2014, 8:12 am

    Added more knowledge on my bucket.
    Thanks TheGeekStuff for this article.

  • Luis Collymoore January 15, 2014, 10:08 am

    Indeed.

  • Arun January 15, 2014, 10:09 am

    Hi,
    Simple & Nice article

  • Tim January 15, 2014, 1:37 pm

    I have always enjoyed reading TGS articles, even if they are sometimes out of my field. On this one, however, you do seem to have missed a vital difference between the two families.

    An SQL database has to have a design, and a designer, and when it’s done right it can be _proved_ to be right. There’s a load of maths theory that says there’s no duplication and no internal integrity failure.

    A non-SQL database is really a pile of stuff, that may be accurate or may not, may be complete or it may not, and almost certainly has duplicated and inconsistent stuff. Not that there isn’t a place for uncontrolled piles of stuff; but I don’t think it’s right to call them databases.

    🙂

    Tim

  • Shiva January 16, 2014, 12:11 am

    Thanks for this useful article. I am going to learn about Mongo DB in detail.

  • Rinshad January 16, 2014, 10:13 am

    Nice article.

  • Pratik January 16, 2014, 11:09 pm

    Nice Article

  • Senthil Kumar January 30, 2014, 11:21 pm

    Learnt something interesting! Thanks for your time!

  • artaxerxes3 February 4, 2014, 2:47 am

    Just small addon, in the part of SQL database you don’t remember main competitors of Oracle, means IBM DB2, and IBM Informix.

  • Bastian VS February 19, 2014, 1:41 am

    Recently I have read about Couchbase. A proudct which came from memcached and couchdb. Its a Nosql Database. Looks like Viber recently migrated from mongodb to couchbase can you share more details about couchbase as well

  • Jayesh March 12, 2014, 1:20 am

    “Easy to read and more to learn” type of artical.

    I like it (Y)

  • sapthagiri June 26, 2014, 5:11 am

    What is the difference between vertical scalability and horizontal scalabilty please explain with example.

  • Kenny Fang November 18, 2014, 9:58 am

    Both SQL and NoSQL databases have their own advantages and limitations, taking advantage of their strengths would be the way to go.

    Generally I would cache the data from SQL database (with those complex queries) into MongoDB (whose table would be huge). Then the Webapp retrieves data from the cached tables or documents in NoSQL DB with the lightening-fast speed.

  • Vin Liyan December 3, 2014, 10:46 pm

    Nice Article, easy to read.

  • Srinivas December 30, 2014, 12:46 am

    Good one 🙂

  • Shiran February 17, 2015, 12:37 am

    Good job !

  • MOhan February 25, 2015, 12:13 am

    Nice article…..I have Sql db … Just i want to dup this data into redis server for timingly. is it’s possible?.. can you suggest me on this…

  • Sliderbahn April 8, 2015, 5:34 pm

    Thanks! Great article.

  • seema August 10, 2015, 1:32 pm

    Thanks !!!!Nicely described for beginners

  • Muhammad August 20, 2015, 2:03 am

    Thanks a lot,
    Well done…

  • Mahesh Koli October 24, 2015, 1:03 am

    Very Clearly Stated All points.
    Liked it ,got a concept.
    Thank you.

  • Ahsan March 14, 2016, 10:53 pm

    Many Thanks for this indeed.
    🙂

    -Ahsan

  • Harold Scott June 8, 2016, 10:15 am

    Thanks for this article, I understood some parts but not everything, does anybody know of a good exective overview? I am just starting to get into programming so the code parts confused me a bit 🙂

  • Rajat July 10, 2016, 7:08 am

    Many Thanx for the description …

  • Asif Billa December 13, 2016, 8:08 am

    Nice article.
    It was really helpful.

  • Dileep December 19, 2016, 2:45 pm

    It is very useful.. Thanks

  • Rashmi January 16, 2017, 11:56 pm

    Very good article….Thanks!!!

  • Os March 6, 2019, 9:44 am

    Very, very good article. Thanks!

  • Raymond Naseef March 25, 2019, 10:13 pm

    This is wonderful, even if several years old. Thank you. I found grammar mistakes:
    1 – you can use NoSQL … not comparable and sable — stable?
    2 – can be classified … as graph databases, key-value store databases, document store databases, column store database — databases

    Also, I believe some SQL servers also function as NoSQL servers, such as Postgres. May be nice to mention that if you haven’t (I haven’t finished reading this yet).