SQL is a language. A database is the system that stores and manages the data. Several different database systems use SQL, each with small differences in syntax, but the core SQL you write works across all of them.
Popular databases (MySQL, PostgreSQL, MS SQL, SQLite)
These are the four most widely used SQL databases you will come across as a data analyst or a SQL developer.
MySQL
MySQL is one of the most popular open source databases in the world. It is free to use and easy to set up. Most web applications and websites run on MySQL in the backend. If a website runs on wordpress, there is a good chance it uses MySQL.
When you are learning SQL for the first time, MySQL is one of the best places to start. It is beginner friendly, well documented and has a large community.
Using our orders table:
SELECT * FROM orders WHERE status = ‘delivered’;
PostgreSQL
PostgreSQL is an advanced open source database. It supports more features than MySQL and handles complex queries better. Many modern data teams and analytics platforms prefer PostgreSQL.
If you are working in a data engineering or analytics role, there is a good chance your company runs on PostgreSQL. It is also the default database for many cloud platforms.
SELECT customer_name, SUM(price) FROM orders GROUP BY customer_name;
PostgreSQL handles this kind of analytical query very well. It also supports advanced features like window functions and JSON columns out of the box.
MS SQL Server
MS SQL Server is Microsoft’s database system. It is commonly used in large enterprises, especially companies that run on the Microsoft stack like Azure, Power BI, Excel. The SQL dialect used in MS SQL Server is called T-SQL (Transact-SQL).
Most corporate environments and government systems you will encounter run on MS SQL Server. If you work in a company that uses Power BI for dashboards, there is a good chance the data lives in MS SQL Server.
One small syntax difference is, to limit rows in MS SQL you use TOP instead of LIMIT;
SELECT TOP 5 * FROM orders;
In MySQL and PostgreSQL the same query would be:
SELECT * FROM orders LIMIT 5;
Same result, slightly different syntax.
SQLite
SQLite is a lightweight database that lives in a single file on your computer. There is no server, no setup, no installation needed. You just created a file and started querying.
SQLite is used in mobile apps, browsers and small local projects. Python’s built-in database support uses SQLite by default. If you have ever used a mobile app that works offline, there is a good chance SQLite is storing that data locally on your device.
SELECT customer_name, product FROM orders WHERE price > 1000;
The same core SQL works in SQLite too. It is a great way to practice SQL locally without setting up a full database server.
Which one should you learn?
All four use the same core SQL. The queries you write in one database will mostly work in the others with small changes.
As a beginner, start with MySQL or PostgreSQL as both are free, widely used and easy to set up. If your company or job uses Azure stack, then MS SQL is great to start with. SQLite is great for quick local practice.
The good thing is, you can start with anyone and learn the core SQL first. The dialect differences are small and easy to pick up once you know the basics.