I get it. You’re trying to learn SQL, but they won’t even tell you the most fundamental part – what you need to run SQL!
You’ve got the SQL code… but where do you actually run it? What software program do you need before you can run your SQL query against a database?
If that’s you, all is about to be revealed!
Basic Requirements
If you’re following along with the examples in a SQL tutorial or book, you’ll need to have somewhere to enter the queries.
Like this, for example:
If you’re going to run SQL queries, you’ll need:
- A Relational Database Management System (RDBMS). Examples include:
- MySQL (What is MySQL?)
- PostgreSQL (What is PostgreSQL?)
- SQL Server (What is SQL Server?)
- Oracle (What is Oracle Database?)
- SQLite (What is SQLite?)
- A database management tool that allows you to run SQL queries against that RDBMS. Examples include:
- MySQL WorkBench (What is MySQL WorkBench?)
- PgAdmin
- Azure Data Studio (What is Azure Data Studio?)
- SQL Server Management Studio (What is SQL Server Management Studio?)
- DBeaver (What is DBeaver?)
- Various command-line interfaces, such as sqlcmd, sql-cli, mssql-cli, sqlite3, etc
- You can also run SQL queries against databases via an application (such as a website), in which case, you can use whatever programming language you’re using (for example PHP, Python, etc).
If you don’t have these installed, below are some links that will help get you up and running.
Installation
Below are links to the official download pages of some of the most popular RDBMSs, as well as the most commonly used tools for running SQL queries against each one.
MySQL
To install MySQL:
- Official MySQL download page (also see the installation guide)
- Official MySQL Workbench (GUI database tool)
Also check out my MySQL tutorial over at Quackit.
PostgreSQL
To install PostgreSQL:
- Official PostgreSQL download page
- PgAdmin download page (database tool for PostgreSQL)
Also, here are some tutorials in case you need help:
- How to Install PostgreSQL on Ubuntu 18.04
- How to Install PostgreSQL on Ubuntu 20.04
- How to Install Postgres.app on a Mac
SQL Server
To run SQL queries against SQL Server, install SQL Server, then install a database tool.
1. Install SQL Server
To install SQL Server, download it from the official SQL Server download page.
For a free edition, choose either the Developer edition or the Express edition. If you need help, see my tutorial How to Install SQL Server (covers Windows, Linux, and MacOS).
2. Install a Database Management Tool
Here are links to help you download and install a tool that will enable you to run SQL queries against SQL Server.
You only need to install one (although you safely install them all if you prefer).
- Azure Data Studio: Download from the official Azure Data Studio download page. This is a database tool that enables you to run queries against SQL Server. It’s available for Windows, Linux, and MacOS. I’ve written some installation tutorials for installing Azure Data Studio:
- How to Install Azure Data Studio (Mac)
- How to Install Azure Data Studio (Ubuntu 18.04)
- How to Install Azure Data Studio (Ubuntu 20.04)
- For Windows users, Azure Data Studio is included when you install SSMS (below)
- SQL Server Management Studio (SSMS): Download from the official SSMS download page. This is only available for SQL Server on Windows. However, it’s a more feature-packed tool than Azure Data Studio. SSMS actually includes Azure Data Studio in its installation, so both are installed alongside each other. See my tutorial How to Install SSMS for installation instructions.
- sqlcmd: Download from the official sqlcmd page. This is a command-line utility that enables you to run SQL queries from the Terminal (Linux/MacOS) or the command prompt (Windows). I’ve written the following tutorials for installing sqlcmd on Linux:
Once you’ve installed SQL Server and at least one database management tool, you can go ahead and run SQL queries.
Also see my SQL Server tutorial over at Quackit.
Oracle Express
To install Oracle Express:
- Official Oracle Express download page
- Oracle Live (this is an online database tool)
SQLite
To install SQLite:
- Official SQLite download page
- The SQLite installation provides a command-line shell named sqlite3 (or sqlite3.exe on Windows)
In SQLite, creating a database uses a different process to most other DBMSs. If you’re stuck because a tutorial isn’t teaching you the SQLite method, see How to Create a Database in SQLite. From there you can write normal SQL queries against your database.
Also check out my SQLite tutorial over at Quackit.