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.

💡 In Simple Words

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_namevalue_description
database_engineMySQL 8.0 Community Server
storage_typeInnoDB Relational Engine
query_languageSQL (ANSI Standard)

3. Clean & Practical SQL Example

Here is the query you run to accomplish the task:

MYSQL
-- 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_versionserver_dateconnected_user
8.0.362026-10-18root@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.
⚡ Quick Rule to Remember

SQL keywords (SELECT, FROM, WHERE) are usually written in UPPERCASE by convention for readability, but MySQL is case-insensitive for keywords.

⚠️ Common Beginner Mistake

Forgetting the semicolon ';' at the end of each SQL statement in terminal or workbench.