SQL and NoSQL…What’s the DIFFERENCE?

Jordan Storms
5 min readNov 6, 2017

--

Coming from a life science background I associated databases and SQL with big research data and statistics. In fact, I took a SAS class in grad school that briefly introduced SQL queries. Before starting my journey into web development, I never considered how important databases and languages like SQL were to our experience on the internet. Every time I logged in to an account I didn’t think about where my information was stored or how sites like Amazon could present me with all the goodies I want to buy, I just knew it worked.

Now it all seems obvious of course.

Once I started learning Ruby on Rails and Active Record, I really began to grasp how all our personal data and a website’s information is stored and passed around. After having the light bulb go off I was interested in what alternatives there were to SQL, since I have heard of other data management platforms like MongoDB. One google search and I realized their were many different ways database management can be approached and thought I’d share what I found here.

Relational vs. Non-Relational Databases

Before mentioning some of the different platforms, I’ll give a brief explanation of relational databases and non-relational databases.

Relational databases were introduced in 1969 by Edgar F. Codd. The idea behind relational databases is, you guessed it, organizing data as relational models. I’ll use twitter as an example. Assume you have a user table with their name, age, and any other relevant items you might want. Each row in the table would be a different user and every column would be a different attribute (name, age, etc.). Since one column is used for one piece of data, where would you put that users tweets? In a second table, otherwise every new tweet would make the tweet column in the user table grow sideways. We all know from Microsoft Excel that this will just look like crap and be a nightmare to sort through each tweet in a single cell. So, we create a second table for tweets with a column for username or a unique id to track whose tweet it is. This means a tweet belongs to a user and a user has many tweets. It gets more complex once we add followers. So a follower follows a user, not a tweet. This means that a follower has many tweets through a user, and a tweet has many followers through a user.

http://fareez.info/blog/build-your-own-twitter/

The tables, data, and relationships are known as the schema or outline of the model. This is a very brief and simplified introduction to relational databases and I encourage you to look up more about them. The has many, belongs to, and has many through concepts can be a bit daunting at first look.

Non-relational databases also use tables but don’t have the traditional relational models. These types of databases are becoming more popular simply due to the increase in the amount of data and how quickly it changes. With more and more data being available daily, it can be difficult to maintain the conventional relational concepts and schemata that were previously used. Google, Facebook, and LinkedIn all use non-relational databases to handle their rapidly growing data. It is also important to note that newer platforms are designed and particularly suited for cloud computing.

Database Management Platforms

The kingpin of the relational database platform SQL (Structured Query Language). It’s been around since 1974, allowing it to have established well-defined standards. That being said, many other relational databases use these standards today. SQL is great for its fast queries which are capable of returning a lot of data. As stated previously, it doesn’t scale as well with ever-changing data. Some of the more common names associated with SQL are:

MySql is an open source relational database created in 1995. Now owned by Oracle.

PostgreSQL is an open source object-relational database system created in 1996.

Oracle databases are relational but is proprietary software.

NoSQL

Non-relational databases are referred to as NoSQL which means “not only SQL”. There are several big names in this area as non-relational databases are becoming more widely used.

MongoDB is an open-source NoSQL system using JSON like documents. It was released in 2009.

DynamoDB is proprietary and is part of Amazon web services. It was released in 2012. This one is interesting since it spreads data over several servers and users pay for throughput rather than storage.

Bigtable, Google’s proprietary NoSQL database, is designed to scale to petabytes of data that is spread across many servers. In 2015 they released a version as a service.

There are many more options for databases and many ways to approach how we access and store the data. So much so, I could probably write a whole series on each one. Learning web development really opened my eyes to what is going on behind the scenes of my browser. A very interesting thing I noticed is how the type of and increase in data is influencing the database platforms that contain it. However, SQL will always have its place and is still a great way to go when developing a website. The last thing I’ll leave you with is a great summary of SQL vs NoSQL I found while writing this blog.

https://www.networkworld.com/article/2839141/cloud-computing/nosql-takes-the-database-market-by-storm.html

--

--