SQL vs NoSQL. Part Three.
In previous posts I talked about SQL and NoSQL, and I want to go into a little more detail (while keeping it simple) what makes them different.
Scalability>>> Think making big things small. In SQL data is stored vertically (so typically all on one server- expensive!). NoSQL stores it horizontally (many servers==ok).
Schema>>> Technically schema means a representation of some model. In programming land, it is used to refer to a structure of a database. So think because you can’t see a database (at least I hope you can’t) you have to think how that structure is represented. In SQL, the schema is fixed, columns must be decided ahead of time, and you have to put data in every column. Remember that wine shelf? You can’t really be adding a new column to your shelf after you’ve built it…it will probably look like all the images when you google “shelf fail.”
I don’t know why, but this shelf is kind of cute.
Also, you have to put a bottle in every slot. Someone’s going to be a happy wine collector.
NoSQL deals with schema in a very different way. It just says “Nope.” and walks away. You can add (or leave out) anything you want, anytime you want. Now that’s flexibility.
Data>>> Finally let’s get to the data. In SQL all rows contain one specific entry. For example, in a row containing information about a bottle of wine you might have “Year”,”Location”,”Winery” etc. You can’t have two years for a bottle of wine, or two locations. In NoSQL, that’s A-OK. You can have two wineries (maybe it was a collaboration?) or no wineries. If that’s what you want.
Next post I’ll be going into more detail about NoSQL and specifically MongoDB.