MySQL Introduction
In this page:
What is MySQL?
MySQL is an open-source relational database management system that stores structured data in tables and lets applications query it reliably at scale. It underpins much of the modern web because it's fast, free, and battle-tested by companies handling millions of records daily.
Example: What is MySQL?
SELECT VERSION();
What is a Relational Database?
A relational database organizes data into tables made of rows and columns, similar to a spreadsheet, but with the crucial addition of relationships between tables via keys. This structure prevents duplicate data and lets you combine information from multiple tables in a single query.
Example: What is a Relational Database?
CREATE TABLE departments (id INT PRIMARY KEY, name VARCHAR(50));
CREATE TABLE employees (
id INT PRIMARY KEY,
dept_id INT,
FOREIGN KEY (dept_id) REFERENCES departments(id)
);
SQL and MySQL
SQL (Structured Query Language) is the standard language for talking to relational databases, while MySQL is the actual server software that parses and executes your SQL. Learning SQL here means the skill transfers directly to PostgreSQL, SQL Server, and other relational systems.
Example: SQL and MySQL
SELECT 1 + 1; -- SQL is the language; MySQL is the server executing it
Why Choose MySQL?
MySQL's open-source license means you can run it in production without licensing fees, and its cross-platform support (Linux, Windows, macOS) makes it a safe default choice for new projects. Its maturity also means extensive documentation and community troubleshooting help.
Example: Why Choose MySQL?
-- MySQL is free, open-source, and runs on Linux, Windows, and macOS
SELECT 'MySQL runs here' AS platform_note;
Your First SQL Commands
Every SQL statement you type is an instruction MySQL parses and executes, and the trailing semicolon tells the server where one statement ends and the next begins. Forgetting it is one of the most common beginner mistakes when chaining multiple commands together.
Example: Your First SQL Commands
SELECT 'Hello, MySQL!';
Chapter Quiz — Complete all 8 topics to unlock
0/8 topics done
Complete these topics first: