Introduction to MySQL & SQL
Understand how relational databases store information and how SQL lets you communicate with databases in plain English.
1. What is MySQL & SQL? (Simple Explanation)
A database is an organized electronic filing cabinet that securely holds millions of user accounts, orders, and products. SQL (Structured Query Language) is the universal language used to ask the database questions, add new records, or update data.
Real-Life Analogy: A library database: The library building is the Database Server (MySQL), the filing cabinets are the Tables, and the request slips you hand the librarian are the SQL Queries.
MySQL is the software that holds your data; SQL is the language you type to talk to MySQL.
2. Sample Data Table: system_info
Imagine your database currently has the following table:
| property_name | value_description |
|---|---|
| database_engine | MySQL 8.0 Community Server |
| storage_type | InnoDB Relational Engine |
| query_language | SQL (ANSI Standard) |
3. Clean & Practical SQL Example
Here is the query you run to accomplish the task:
-- Check MySQL server version and current date
SELECT
VERSION() AS mysql_version,
CURRENT_DATE() AS server_date,
USER() AS connected_user;
4. Query Result (Output Table)
When MySQL executes your query, this is the exact result table returned:
| mysql_version | server_date | connected_user |
|---|---|---|
| 8.0.36 | 2026-10-18 | root@localhost |
Step-by-Step Breakdown:
- SELECT: The primary command in SQL to retrieve and display information.
- VERSION(), CURRENT_DATE(): Built-in server functions returning system status.
- AS alias_name: Renames the output column to a clean, readable header.
SQL keywords (SELECT, FROM, WHERE) are usually written in UPPERCASE by convention for readability, but MySQL is case-insensitive for keywords.
Forgetting the semicolon ';' at the end of each SQL statement in terminal or workbench.