 What's going on everybody? Welcome back to another video. Today we're going to be comparing some of the most popular types of SQL, including MySQL, PostgreSQL, and Microsoft SQL Server. Now when I was first starting out, I had no idea that there were different types of SQL. I just thought SQL was SQL, just like Excel is Excel. It's just a tool and everybody uses it the same way. But I started learning MySQL and then the first job that I got was Microsoft SQL Server and it blew my mind. It was completely different than what I had studied and that may be exactly where some of you guys are at right now, which is you're either studying it or you're using one of these types of SQL and you just realized that there are different types of SQL out there and you don't know if the one that you're studying or the one that you're using is the best option. So in this video, we're going to be comparing three of the most popular types of SQL out there. I'm also going to pull up on my screen. Each of these SQL databases kind of walk you through the user interface as well as some of the differences between them. So you can really see the differences between these different types of SQL. And then at the end I'll give you my thoughts on which one I think is the best for different uses and the ones that I personally like the most. So without further ado, let's jump on my screen and take a look at these different types of SQL. So again, we're going to be taking a look at MySQL, PostgreSQL and Microsoft SQL Server and I did not choose these randomly. I chose these based off popularity. So if you look at these graphs or actually surveys taken from Stack Overflow where people were able to vote on their favorite type of SQL and these were the results. And so each one of these represents a different year that they took the survey, which was 2016, 2017 and 2018. And so if you look at each of these, you'll notice that MySQL, PostgreSQL and Microsoft SQL Server are consistently ranking amongst the top. So now we just want to look at a really high level view of some of the similarities and differences between these three different types of SQL. The first thing I want to look at is whether it is open source or not. And open source just means it is freely available. You can go and download it and use it in any way you want completely free. So looking at MySQL, MySQL is open source and it's actually developed by Oracle and Oracle has an Oracle SQL, which is kind of their commercialized version, which is paid and you cannot get for free. So MySQL is Oracle's free or open source option, although they do have upgrades, you do not have to purchase them. And then there's SQL Server, which is not open source is a commercial product made by Microsoft. But there is a free version called SQL Server Express and you can download that and use it. But it has a lot of limitations and so it's definitely not open source. And then there is PostgreSQL, which is open source and really doesn't have a paid version. So it is truly open source. Now the next thing that I want to look at is what operating systems these types of SQL are able to work on. And MySQL and PostgreSQL are really going to work on any type of machine or operating system that you have. Really the only outlier here is Microsoft SQL Server, which only runs on Linux and Microsoft. And so if you have a Mac and you really want to learn Microsoft SQL Server, you might have to boot up a virtual machine or a remote desktop or something like that in order to actually use it, which is just really inconvenient, to be honest. And lastly, what kind of SQL do these types of SQL actually use? Well, there's the standard version of SQL, just basically your base level of SQL, and it's going to have a lot of the same functionalities. And so MySQL and PostgreSQL are really that core type of SQL. The only outlier here again is Microsoft SQL Server, where they have something that they invented called tSQL, which is called transact SQL, and that sits on top of standard SQL and has a lot of extra functionalities. And so they all are really built on the standard version of SQL is just Microsoft to win a little above and beyond to add some functionality that the others don't have. So now I'm going to pull up each of these different types of SQL databases, so you can see the user interface as well as kind of how they work. So we're going to be taking a look at MySQL first, and I'm using MySQL Workbench. That's what almost everyone's going to be using when they're using MySQL in order to query their data. So right here, I just have a test script written. So you can kind of see what the syntax of it is. And you'll note that all of the syntaxes are very similar. But there are some key differences. I'll try to point those out as we go through. But, you know, we're mostly looking at the user interface here. So here's a query window, we kind of have that open. So over here, we have our test database, and we have our tables. And in this table right here called bike buyers clean, we have all of these columns right here. And so that's the actual table that we're querying off right here. Now, if I take this really quick, and I put it down here, I just say, select star, which means select everything, I can highlight this, and I can click this button right here, which is going to execute. And it's going to show me all the data in here. And now, if I want to run this, I can select this right up here, and run. And I can get, you know, this aggregated query that I've done right here, where we're taking the average income. And if you look right down here, there's actually this output, and you can kind of see the different, the different queries that we've done in the past, how long they took, and some, you know, useful information. And right up here on the top left, there's lots of different things that we can do. I'm not going to go through all of them. But you can get a new tab for SQL and you can start writing new queries. You can create new schemas and new tables and views as well as stored procedures. And if you go up here, you can connect to different databases or manage the connections that you already have. And you can also come over here to this server, where you can import and export data. And it kind of helps you do that. And so just looking at my SQL as a whole, it is very simple, it is very clean and understandable. There's nothing really confusing about it. And the syntax is pretty easy and pretty simple to pick up and understand. All right, so let's look at Microsoft SQL Server. And we're actually in something called Microsoft SQL Server Management Studio called SSMS. And so it's somewhat similar in a way to my SQL, right? You have all these options up here, and we'll look at those in just a second. You have this editor window, you have this output window. And then on the left, you kind of have this object explorer that shows you the hierarchy, right? So we have our databases within there, we have our tables. And so if we come down here, this is the one we're looking at right here, this employee demographics. If we right click on it, you can select top 1000. And it's just going to select the top 1000 of all of these. And so, you know, it's pretty simple. It's pretty self-explanatory once you actually kind of get a feel for it. It's very simple, just like my SQL. One difference I will say, and it's hard to really show this, but getting data into one of these databases, I've noticed that it's significantly easier, at least from my opinion, to get data into Microsoft SQL Server. It's a little bit more challenging I found to get it into my SQL. Again, it's not something I can easily show in a video. And so just like the last one, I have this script right here that kind of shows just a little aggregate query where we're grouping things and kind of filtering on things. And we get this output. And so one of the differences that you may have noticed is that at the end of my SQL, you're going to get this semicolon. We don't need it. We don't have to have it. Traditionally, with my SQL, you need to have it. And so earlier I mentioned that Microsoft SQL Server has something called T-SQL that sits on top of standard SQL that only Microsoft has. And so to give you an example, you can do select top 10. Let's do everything. We'll do from employee demographics. And this is the exact same thing as what limit 10 is in my SQL, but it does it a little bit differently in Microsoft SQL Server. And there's also another really cool thing that you can do, which is you can kind of see the inner workings of the back end of SQL using these sys tables. So I'm going to do select everything and we'll do from, and we're going to say sys.tables. And we're just going to run this. Now, right now, if we just run it without using something like use and do SQL and we choose a database, it's just going to run off this SQL or this database right here. What we're going to do is we'll select SQL tutorial and we're going to hit execute. And these are the three tables that are right here. And so if you have hundreds of tables, then you can start filtering on these tables. You can start filtering on when you added these tables or when you created them. And you can even do go as far as the columns. And you can really use these, and I've used these a lot myself, you can really use these to dig in and find things much faster than having to manually go in there and find it yourself. And then up top here, just like in my SQL, we have all these different options. And I will say, I think it's a little bit more confusing than in my SQL, because there's just more options, there's more things that you can do. And so, you know, you can just like before, you can create a new query. And we can also do things like commenting out. So you know, if I just want to comment this out, there's lots of different random things that you can do. We can save files, we can open files. And if we want to add a new connection, we can go over here, we can select file and choose, you know, how we want to import that data. So overall SQL server is really good. And if you compare it to my SQL, the UI is actually quite similar. They look a little bit different, but you know, they have the editor window, they have the output, they have this object explorer where you can see, you know, their tables and your databases. And they have this area up here to add some extra functionality. Probably the biggest difference is that Microsoft SQL server is a paid option. It has a lot more functionality. And it has T SQL, which I haven't been able to demonstrate super well. But if you really dig into it and look at it and use it, you'll notice that T SQL has a lot of really great features for querying your data. It's actually really helpful, which is why I personally really like it. So now let's go into PostgreSQL. And to do that, we are using PG Admin 4. It's kind of like using the MySQL workbench or the SQL Server Management Studio. For this, we use PG Admin 4. And right off the bat, you'll notice it's pretty similar, except it's even, I would say more simple than MySQL. So on this left hand side, we have our database or we have our servers up top, we have our database. All the way down here, we have our tables. And then we can look at, you know, our columns within it. And right off the bat, just when glancing at it, you notice right away that the syntax is a little bit different, right? I have these quotation marks. And I believe there are different versions where you don't need the quotation marks. But I've always used PG Admin 4 where it does have it. And I know PG Admin 4 is pretty popular. We can go in here, we can right click, and we can go to Scripts, and we can go to Select Script. And it's just going to pull up the Select statement, which we can then go over here, and we can execute. And so now we can look at this data, has this explain messages and notifications, which is pretty interesting as well. Something that is unique to PostgreSQL, something that I think is just really interesting, although I don't use it a lot if I'm being honest, is it has these other options up here, like this dashboard, where you can see how many queries you're running, how long it took to run, the transactions per second, really interesting information. Again, not something that I go into too much, or I've ever really gone into too much. And you can look at the properties. This one specifically, it's kind of shown in a different way in the different types of SQL. But it just has it as an option at the top, so that you can kind of just go in here, click around instead of having to click on dropdowns, click on the menu items, it's all just kind of right in front of you. So again, if we look back up here, we have an option to just create a query window like we did before. We can look at our data so we can just view this data if we click on that button. So it doesn't just pull up by script for us, it's actually viewing the data. And then there's other options up here. So we have this file, object, and tools. And then you can go down here to import and export data. So you actually import your data from here. And if I'm being completely honest, I would say that in PostgreSQL, I've had the most issues with importing data. It's a little bit tougher than MySQL. It's a little bit tougher than Microsoft SQL Server. That's just my opinion. But you just got to make sure you have everything exactly right. Otherwise, you know, you'll definitely hit some errors and it can be a little bit frustrating. But you know, each type of SQL has its issues. This one to me is just always one that I have personally had issues with. So thought I would mention it. Alright, so now that we've actually gone into each type of database and we've taken a look and we've kind of seen the differences between all of them, I'm going to give you my overall thoughts on each of them. Starting with MySQL, I think it is a fantastic option. If I'm being completely honest with myself, I think that MySQL is probably the one that most people should start with because MySQL is probably the most straightforward syntax wise. It's very easy to get up and install. The user interface is very straightforward and it's completely open source, which means you can actually use it for data or your business or from learning or really whatever you want. And so I genuinely just think it's a fantastic options for a lot of people out there. And I think a lot of people agree because if you saw those surveys from earlier, a lot of people really like MySQL and use MySQL. The next one is Microsoft SQL Server. And if I'm being honest, this is the one that I have used the most in my career and I'm super impartial to because I absolutely love it. But I don't recommend it over MySQL by just a hair because MySQL is open source. Anybody can use it for anything. And I think that is a beautiful thing. And a lot of people are not going to pay for Microsoft SQL Server. Although I think TSQL is the best. I absolutely love it. I've used it so much. I just think that if I had to choose between MySQL and SQL Server, I would choose MySQL because it's completely free and it always will be and has no limits because of the free version like SQL Server has. And lastly, we have PostgreSQL, which is really just the biggest competitor to MySQL because they're both open source. I really do like the simplicity of PostgreSQL. But if I'm being honest, I like MySQL's user interface a little bit more. I'm also not the biggest fan of the PostgreSQL syntax. Again, it's just not as intuitive as MySQL. It's absolutely not as intuitive as SQL Server, which is what I think is the easiest syntax out of all of them. But to me, PostgreSQL is really the third option out of all of these. I think that the best one, the one that I would start with and one that I recommend right now is MySQL if you are just picking up SQL. So if I had to rank them on which ones I would recommend to you to learn first or to use, I would recommend MySQL first. I just think that it is the best one for the most amount of people. I would then recommend SQL Server. That is the one that I personally have used the most, the one that I personally love the most. That does not mean that I recommend it to everyone. Again, it costs money and the free version does not have everything. And so I don't recommend it as much as MySQL. And then in third place, it'd be PostgreSQL. Again, quite a good competitor to MySQL. I just, I think MySQL is a little bit better in a few different aspects, which we discussed. But PostgreSQL is still a really good option if you're looking for something open source and you're really wanting to learn SQL. So that is my comparison. That's my overview of these three different types of SQL. I hope that you found that helpful. If you did, be sure to like and subscribe below. See you next time.