In this chapter, we answer the question “what is SQL?”, see why it’s used everywhere, then install MySQL.
What is SQL?
SQL stands for Structured Query Language. It’s a language designed to query, manipulate and manage data in relational databases.
A relational database stores information in tables. For example, a database can contain a person table and a city table:
- each table has columns, and each column stores one specific kind of information;
- tables can be linked together: a person lives in a city. We’ll cover these relationships in detail in the coming chapters.
Why use SQL?
Everything that deals with data, whether it’s a website, an app or a company, relies on databases. SQL is the key to accessing them: it lets you retrieve specific information, sort it, filter it and update it.
It’s also usable from most programming languages. In PHP, for example, the MySQLi and PDO extensions run SQL queries directly: everything you learn here works as-is in your projects.
Another concrete example: turning an Excel file into a table. A file with name, birthday and city columns becomes a table with the same columns, plus an id for each row.
Installing MySQL
MySQL is a relational database management system (RDBMS) widely used to store data for web applications. It’s a personal choice for this course: PostgreSQL or Oracle work too.
You have several ways to install it:
| System | Tool | What it installs |
|---|---|---|
| Windows | WAMP | Apache, MySQL (and MariaDB), PHP and phpMyAdmin |
| Linux | LAMP | Apache, MySQL and PHP |
| Any | Official MySQL website | MySQL alone, plus MySQL Workbench if you want a GUI |
For a web developer who mainly works with PHP, WAMP on Windows (or LAMP on Linux) is the most convenient: everything gets installed at once.
Installing WAMP
- Search for WampServer on Google and open the official website.
- Download the latest 64-bit version. It installs Apache 2.4, several PHP versions (up to 8.4), MySQL 9.1, MariaDB and phpMyAdmin.
- Run the
.exefile and follow the installer. - Start WAMP: its icon appears in the taskbar. When it turns green, all services are running.
Opening phpMyAdmin
Click the WAMP icon, then phpMyAdmin, or go straight to http://localhost/phpmyadmin.
- Choose the MySQL server.
- User:
root, with no password by default.
You land on an interface that lists all your databases. Click a database to see its tables.
phpMyAdmin is very handy, but in this course we’ll mainly learn to write real SQL queries. GUIs will come later to save you time.
What’s Next
In the next chapter, we create and delete our first databases, from the command line and with phpMyAdmin.
This is Chapter 2 of the SQL from Zero to Pro course. Follow along to learn SQL with MySQL, from the basics to joins.