Back to articles list Articles Cookbook
8 minutes read

SQL in the Open-Source World

Did you know there are free, open-source databases that use SQL? In this article, I'll show you which open-source database solutions can meet your needs.

Ever wonder why many people still use paid programs when the same things can be done with free options? Personally, I am an avid supporter of the open-source movement. For years, I have been trying to apply and promote such solutions and support an active community around them. So, let’s see how the open-source concept has been applied to SQL and databases, shall we?

First, let me say that I am not trying to forcefully demonstrate the superiority of one solution over another. I’m not trying to convince anyone to join some radical software revolution. Rather, I want to point out that you don't always have to choose the most obvious solution or be limited to commercial software.

Okay, now let’s delve into the world of open-source databases. We’ll start with a question – what exactly is open source?

Open Source… What Does That Mean?

I bet you've heard the term many times. Still, some readers may not have come across it before, so let’s be clear. The Cambridge Dictionary defines open-source software this way:

open-source software

Seems simple, right? Let's take a closer look. Open source doesn't have to mean free. You can use many open source programs for free at home, but not necessarily commercially. Most often, however, the developers of open source tools do not charge for their software. They earn thanks by voluntary subsidies/donations or by offering paid support.

Usually, an open-source program can be modified to suit your needs. However, always remember that the software’s creator owns the copyright. The entire open-source movement grew up around a special idea, which was that people all over the world could create additions and improvements to the product as part of a community. Sometimes, most of  the program’s code even gets rewritten! As a result, solutions are becoming better and more convenient – but we still owe the creator some respect.

The open-source community is full of people with passion and a vision for a world where good tech solutions are available to everyone. Ok, this sounds a bit like the John Lennon song Imagine, but even a skeptic like me must admit that many open-sourcers are brilliant people. Just think of three people most associated with open source: Linus Torvalds (the creator of Linux), Guido van Rossum (the creator of Python) or Eric Raymond (one of the leaders of the movement). Enough said. Let’s move on.

Windows, MacOS, or Something Else?

The software world has been divided into people using Windows, people working on macOS, and those "others" who for some reason use something else. Or not. This is a popular view that has nothing to do with the truth. Today, Linux and its many flavors are an ideal, free, and open-source alternative to commercial applications. For home applications, Ubuntu or Mint (two popular, beginner-friendly Linux distros) are perfect.

Survey

The real power of Linux is, however, most visible among professional developers and programmers. As the Stack Overflow Survey 2020 shows, more than half the professionals surveyed chose the Linux platform and a quarter use it as their primary OS.

Survey

The Best Open-Source Databases

Let’s assume you've already installed your favorite Linux distro and LibreOffice and are listening to your favorite album on VLC. Nice, but what about the database? Can you count on open-source solutions here? Yes! And in my opinion, the open-source offerings are much better than the commercial ones!

It used to be that only Oracle, IBM and Microsoft relational databases mattered – and you had to pay a lot to use them. Fortunately, those times are long gone; today’s market is filled with open-source DBMSs (database management systems). Moreover, companies have noted that it doesn't make sense to pay for something they can use for free via open-source licenses. When that happened, there was a need for new DBAs fluent in these open-source technologies, and the circle was closed.

There seems to be no turning back from this path. While many companies still use commercial DBMSs, open-source versions aren’t going anywhere; the popularity of MySQL or (my favorite) PostgreSQL leaves no room for doubt. What's more, there are gigantic Internet communities behind these DBMSs. Every day, thousands of people write new extensions and scripts for PostgreSQL or MySQL, furthering their use. And this isn’t just the case for SQL databases; in NoSQL too, open-source solutions dominate the paid ones.

Let’s look at the open-source SQL databases that currently lead the way:

PostgreSQL

PostgreSQL

I have repeatedly admitted in my articles that PostgreSQL is my preferred DBMS, maybe because of its active community of enthusiasts. PostgreSQL (Postgres for short) was developed by researchers at the University of California, Berkeley. First, they named it Ingres, but as the project developed, its name was changed. The current name emphasizes the system's compliance with the SQL standard.

A while ago, I wrote an article about which giant companies use Postgres. I recommend taking an example from them and learning PostgreSQL. Not sure where to start? Try the LearnSQL SQL Basics in PostgreSQL course. If you want more than just a basic understanding, look at the track SQL from A to Z in PostgreSQL. If you are serious about a career in IT – maybe as a developer or database administrator – don't hesitate to start learning this important skill. Even if you are just curious about databases, it’s worth learning a bit of Postgres.

Want to start using PostgreSQL on your computer? Nothing could be simpler - we have prepared a guide for you on installing PostgreSQL on Windows 10.

MySQL

MySQL

MySQL has been at the top of the popularity charts for several years now. It has a lot of add-ons and extensions. It's a great free and open-source choice for anything that requires working with relational databases. And you can run it on most popular platforms, including Linux, Windows, and macOS.

MySQL was created in 1994 by the Swedish developers David Axmark and Michael Widenius. In 2008, MySQL was acquired by Sun Microsystems. In 2010, Sun (and thus MySQL) was bought by Oracle. Although it came under the wing of an IT giant, MySQL still remains free and open-source. Company representatives swear that this will never change.

SQLite

SQLite

SQLite is amazingly practical. It is no coincidence that it is chosen increasingly often by mobile developers – it is simply good. The library implements the SQL engine, making it possible to use a database without having to run a separate DBMS process. In practice, this means that it is really fast and effective, especially on slower or older devices.

SQLite is based on the SQL-92 standard. This means that you will be able to work with it after finishing our SQL Basics course.

If you dream of creating Android or iOS applications, you will have to learn to love SQLite sooner or later. Fortunately, it is not difficult. My colleagues and I have prepared special SQL Cookbooks (in the SQL Standard and all popular dialects) that will help you solve common problems. Enjoy!

Finally, there’s one more candidate on our list, even though it’s not a traditional SQL database.

MongoDB

MongoDB

If you don’t need a predefined structure and will be storing different types of data in one place, a NoSQL database may be the better choice. (Not sure what a NoSQL database is? Read this article.) The most popular JSON-based solution is MongoDB. (There are other types of NoSQL databases available. If you want to know more about JSON, click here.)

MongoDB is used by many companies, including the Large Hadron Collider in Geneva, Switzerland. You have to admit it – it's pretty cool to use the same tool as the scientists overseeing the biggest machine in the world.

What does MongoDB have going for it? First of all, it works with JSON files, which makes it easy to integrate with other applications. Second, it is easy to scale and quite effective even with huge datasets. The disadvantages? Many developers say it has poor security. Others point to its limited support of UTF-8 encoding, which can create a problem with non-English text data.

Next Step? Brush Up Your SQL

Now that you know about the open-source DBMSs available, it's time to get down to business. And that means learning SQL.

At LearnSQL.com, we believe that you can learn SQL only through practice. I recommend our SQL Practice track for people who know the basics and want to practice their knowledge before putting it to work in the real world. (Hint: This course is also available in PostgreSQL if you choose to go that route.)

Do you want to start your own project? Start with a free database and some of the openly available data sets; I listed my faves in the article Where can I find free online data sets to practice SQL?. Each line of SQL query will bring you closer to being a professional.

Now you know how and why you should learn SQL, right? All you have to do now is start learning. Good luck!