SQL vs NoSQL | What's the Difference?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on everybody welcome back to another video today we're going to be taking a look at sql versus nosql [Music] now if you've watched my videos for a while now i am sure you know what sequel is but i'm guessing a lot of people haven't heard of what nosql is and that's exactly where i was about maybe two or three years ago when i joined my current company and they said we use a nosql database i was understandably pretty confused because i never heard of what that is i'd really only heard about a sql database was and so i thought it was worth looking at with all of you to kind of explain the differences so that if you do encounter a nosql database you weren't completely unprepared like i was now when we say sql versus nosql what we really mean is a sql database versus a nosql database sql is of course the querying language should be able to retrieve data from that database and that databases typically are always a relational database now a relational database is going to have tables that have columns and rows that store your data for you so it's very organized rows are going to store your data as well as have unique identifiers which helps you distinguish your different rows from one another and a relational database is also going to be vertically scalable so let's take a look at this picture really quick so as you can see on this left-hand side there's a vertical scaling and it says increase the size of your instance a ram or cpu so you can picture this as if you were trying to pick up a very large couch it's just a little bit too big for you and so you take some steroids and you get a little bit stronger and you're able to lift that very heavy couch now this is compared to horizontal scaling on the right side which is you add more instances so instead of you just getting larger and picking up the couch you invite some of your friends over and you all pick up the couch together horizontal scaling has been proven to be quite a bit more efficient because you know you're not putting so much workload on just one server or one instance what you're doing is really spreading it out and allowing a lot of people to help at once or a lot of instances to help at once some examples of a relational database or a sql database is mysegal postgresegal and microsoft sql server a quick example of how data would be stored in a relational database is you have your columns at the top so this employee id first name last name those are columns and then for rows we have 1001 2 and three and in each one that is a unique identifier so that one thousand and one two and three those are unique to that individual and that is also labeled the primary key for this table to query from a sql database you're gonna be using the sql syntax which you can see right here so we have select from and where and a few other things as well and then we have our output on the bottom and again it's in that same format of columns and rows so now let's look at nosql which is kind of a short version for saying not only sql it can still hold relational data but it doesn't store it in a table with columns and rows like a relational database does it also can store completely unstructured or semi-structured data which a relational database cannot do a nosql database is also horizontally scalable which if you remember from before is where it brings on more instances to decrease the load on one specific instance now there's not just one type of nosql database it's many different types and you can pull in many different types of unstructured and semi-structured data so we have a key value database a column-oriented database a document database and a graph database and each one is specifically used for that purpose some examples of nosql databases are things like mongodb cassandra and many others that you can see right here so now let's take a look at how these two databases can store their data differently a relational database like we looked at before can store it in columns and rows within a table but for a nosql database it's going to look a little bit like this at the bottom where it's in this semi-structured form it has the exact same data as above but it's just stored in a semi-structured way now to show you how to query out of a nosql database we're going to take a look at mongodb and there are a lot of languages that you can use to query a nosql database but you can't use sql now to show how you can query the data out of a nosql database we're taking a look at mongodb which is one i am most familiar with there are a lot of languages that you can use to actually retrieve your data from a nosql database the one that i'm most familiar with would be python but i've also used the mongodb query language as well now there's really no way of saying which one is better because they really have different use cases i personally have used sql for a lot longer and i really like the simplicity of it and the organizational abilities of using a sql database but there are so many different purposes for a nosql database so if you're looking for a place to store your data here's some things that you may want to look at in order to determine which one would be better to store your data in so for a sql database it's going to be very good at storing structure to data has very easily understood data integrity or a lot more understandable than a nosql database it's going to be very flexible with how you're querying it and the things that you can do to kind of manipulate it when you're retrieving that data and it also handles medium level of transactions well now i say medium level because if it's taking in a ton of transactions if 10 000 or hundreds of thousands per second then it really gets bogged down and can even break whereas typically a nosql database can handle those high transactions a lot better so for a nosql database it stores unstructured data or semi-structured data very well it also is very highly scalable so if you're bringing in a ton of data a nosql database will be able to handle that a lot better than a sql database and it also has a very low latency for data retrieval or it typically has a much lower latency for data retrieval it just depends on what you're querying and how much data is actually there so i hope that that was helpful i know that when i started using a nosql database about two or three years ago i had no idea what they were so hopefully you know a little bit better about the differences and the use cases for those types of databases thank you guys so much for watching i really appreciate it if you like this video be sure to like and subscribe below and i'll see in the next video [Music] you
Info
Channel: Alex The Analyst
Views: 44,957
Rating: undefined out of 5
Keywords: Data Analyst, Data Analyst job, Data Analyst Career, Data Analytics, Alex The Analyst, sql vs nosql, nosql, nosql database, what is nosql, what is sql
Id: Pf-9pjJK1e0
Channel Id: undefined
Length: 5min 55sec (355 seconds)
Published: Tue May 03 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.