Paramclasses Academy - Blog

Tutorials Details

MySQL Tutorial for Beginners: Complete Introduction to Database & SQL

MySQL Tutorial for Beginners: Complete Introduction to Database & SQL

October 1, 2026

1. Introduction

If you are learning PHP, CodeIgniter, WordPress development, or web application development, understanding MySQL is very important.

MySQL is one of the most widely used Relational Database Management Systems (RDBMS). It is used to store, manage, retrieve, update, and delete application data.

For example, when a customer fills out a website enquiry form, the information can be stored in a MySQL database:


 
Website Form
     ↓
PHP / CodeIgniter
     ↓
MySQL Database
     ↓
Customer Information

A website may use MySQL to store:

  • Customer information
  • Login details
  • Products
  • Orders
  • Leads
  • Payments
  • Blog posts
  • Employee records
  • Student information
  • Contact enquiries

2. What is a Database?

A database is an organized collection of information that can be easily stored, searched, updated, and managed.

Real-time example

Suppose you are developing a School Management System.

You need to store information about:

  • Students
  • Teachers
  • Classes
  • Fees
  • Attendance
  • Exams

Instead of storing everything in separate Excel files, you can create one database:


 
school_management
│
├── students
├── teachers
├── classes
├── fees
└── attendance

Create the database using SQL:


 
CREATE DATABASE school_management;

Then select it:


 
USE school_management;

3. What is a Table?

A table is where actual data is stored inside a database.

Think of a table like an Excel sheet.

For example:

students table

id name mobile city
1 Rahul Sharma 9876543210 Raipur
2 Amit Verma 9876543211 Bilaspur
3 Priya Sahu 9876543212 Durg

Create this table:


 
CREATE TABLE students (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    mobile VARCHAR(15),
    city VARCHAR(50)
);

4. What is a Row?

A row represents one complete record.

For example:


 
1 | Rahul Sharma | 9876543210 | Raipur

This is one row/record.

Another:


 
2 | Amit Verma | 9876543211 | Bilaspur

is another record.

So:


 
Table
 ↓
Rows
 ↓
Individual Records

5. What is a Column?

A column represents a particular type of information.

Our students table has:


 
id
name
mobile
city

Here:

  • id → Student ID
  • name → Student Name
  • mobile → Mobile Number
  • city → City

So a column defines what type of information we are storing.


6. What is SQL?

SQL stands for Structured Query Language.

It is used to communicate with a database.

For example:

Insert data


 
INSERT INTO students
(name, mobile, city)
VALUES
('Rahul Sharma', '9876543210', 'Raipur');

View data


 
SELECT * FROM students;

Update data


 
UPDATE students
SET city = 'Bhilai'
WHERE id = 1;

Delete data


 
DELETE FROM students
WHERE id = 1;

These are SQL queries.


7. What is RDBMS?

RDBMS stands for:

Relational Database Management System

MySQL is an RDBMS.

The word relational is important because different tables can be connected with relationships.

For example:


 
customers
    │
    │ customer_id
    ↓
orders

A customer can have multiple orders.

customers

id name
1 Rahul
2 Amit

orders

id customer_id amount
1 1 ₹5,000
2 1 ₹2,000
3 2 ₹7,500

Here customer_id connects the two tables.


8. MySQL vs SQL

Beginners often confuse these two.

SQL

SQL is a language used to communicate with databases.

MySQL

MySQL is a database management system that understands SQL.

Simple example:


 
SQL
 ↓
Language
 ↓
Used to communicate with database

MySQL
 ↓
Database Management System
 ↓
Stores and manages data

9. Installing MySQL

For beginners, you can use:

Option 1: XAMPP

XAMPP is popular for PHP development.

It provides:


 
Apache
MySQL
PHP
phpMyAdmin

Option 2: MySQL Workbench

MySQL Workbench provides a graphical interface for working with MySQL databases.

Option 3: Hostinger/cPanel

When working on a live website, MySQL databases can commonly be managed through the hosting control panel and tools such as phpMyAdmin.


10. What is phpMyAdmin?

phpMyAdmin is a web-based interface for managing MySQL databases.

Instead of typing every command manually, you can perform many database operations through a graphical interface.

For example:


 
phpMyAdmin
     ↓
Database
     ↓
Tables
     ↓
Insert / Edit / Delete / Search

You can also directly execute SQL:


 
SELECT * FROM students;

11. What is MySQL Workbench?

MySQL Workbench is a graphical development and administration tool for MySQL.

It is useful for:

  • Writing SQL queries
  • Creating databases
  • Creating tables
  • Designing relationships
  • Managing database servers
  • Visualizing database structures

For professional development, learning both SQL commands and graphical tools is useful.


12. Complete Real-Time Example

Let's create a small Customer Management System.

Step 1 — Create Database


 
CREATE DATABASE customer_management;

Select it:


 
USE customer_management;

Step 2 — Create Customers Table


 
CREATE TABLE customers (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    mobile VARCHAR(15),
    email VARCHAR(100),
    city VARCHAR(50),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Step 3 — Insert Customer


 
INSERT INTO customers
(name, mobile, email, city)
VALUES
(
    'Rahul Sharma',
    '9876543210',
    'rahul@gmail.com',
    'Raipur'
);

Add another customer:


 
INSERT INTO customers
(name, mobile, email, city)
VALUES
(
    'Amit Verma',
    '9876543211',
    'amit@gmail.com',
    'Bilaspur'
);

Step 4 — Display Customers


 
SELECT * FROM customers;

Result:

id name mobile email city
1 Rahul Sharma 9876543210 rahul@gmail.com Raipur
2 Amit Verma 9876543211 amit@gmail.com Bilaspur

Step 5 — Search Customers

Find customers from Raipur:


 
SELECT *
FROM customers
WHERE city = 'Raipur';

Step 6 — Update Customer

Suppose Rahul moves to Durg:


 
UPDATE customers
SET city = 'Durg'
WHERE id = 1;

Step 7 — Delete Customer


 
DELETE FROM customers
WHERE id = 2;

13. Real-World Website Example

Suppose Paramwebinfo receives website enquiries.

A visitor fills out:


 
Name: Rajesh Gupta
Mobile: 9876543210
Service: Website Development
City: Raipur

The website can save this information in MySQL.

leads table


 
CREATE TABLE leads (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    mobile VARCHAR(15),
    service VARCHAR(100),
    city VARCHAR(50),
    status VARCHAR(30) DEFAULT 'New',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Insert the enquiry:


 
INSERT INTO leads
(name, mobile, service, city)
VALUES
(
    'Rajesh Gupta',
    '9876543210',
    'Website Development',
    'Raipur'
);

Now the CRM can retrieve all new leads:


 
SELECT *
FROM leads
WHERE status = 'New';

This is a real-world application of MySQL.


14. MySQL Database Structure

A typical business application might look like this:


 
CRM DATABASE
│
├── users
│
├── customers
│
├── leads
│
├── tasks
│
├── quotations
│
├── invoices
│
├── payments
│
└── support_tickets

Each table stores a specific type of information.

Later, we can connect these tables using Primary Keys and Foreign Keys.


15. Important Beginner SQL Commands

You should remember these commands first:

Command Purpose
CREATE DATABASE Create database
USE Select database
CREATE TABLE Create table
INSERT Add data
SELECT Read data
UPDATE Modify data
DELETE Remove data
ALTER TABLE Change table structure
DROP TABLE Delete table
TRUNCATE Remove all records

16. Beginner Practice Exercise

Create a database called:


 
CREATE DATABASE shop_db;

Select it:


 
USE shop_db;

Create a products table:


 
CREATE TABLE products (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    price DECIMAL(10,2),
    category VARCHAR(50),
    stock INT
);

Insert three products:


 
INSERT INTO products
(name, price, category, stock)
VALUES
('Nike Shoes', 3500, 'Shoes', 20),
('Samsung Mobile', 25000, 'Mobile', 10),
('HP Laptop', 55000, 'Laptop', 5);

Display all products:


 
SELECT * FROM products;

Find products costing more than ₹10,000:


 
SELECT *
FROM products
WHERE price > 10000;

Find products with stock below 10:


 
SELECT *
FROM products
WHERE stock < 10;

17. What You Learned