Lesson 1 of 60 – Introduction to MySQL
2%

Introduction to MySQL

MySQL is one of the most popular relational database management systems. It is used to store, organize, manage, and retrieve data efficiently. MySQL is widely used in websites, web applications, business software, and many other systems.

Note: MySQL is a database management system that uses SQL to create, manage, and work with relational databases.

1. What is MySQL?

MySQL is a Relational Database Management System (RDBMS).

It allows us to store data in tables consisting of rows and columns.

MySQL = Database Management System

2. What is a Database?

A database is an organized collection of data.

For example, a student database can contain student names, mobile numbers, courses, fees, and attendance.

Student Database
    ↓
Students
Courses
Fees
Attendance

3. What is an RDBMS?

RDBMS stands for Relational Database Management System.

It stores data in related tables and allows relationships to be created between those tables.

MySQL is an example of an RDBMS.

4. What is SQL?

SQL stands for Structured Query Language.

SQL is used to communicate with relational databases.

We use SQL commands to create databases, insert data, retrieve data, update records, and delete records.

5. MySQL and SQL

SQL and MySQL are not the same thing.

  • SQL is a language.
  • MySQL is a database management system.

MySQL uses SQL to perform database operations.

6. Where is MySQL Used?

MySQL is commonly used in:

  • Websites
  • Web applications
  • School management systems
  • Library management systems
  • E-commerce applications
  • Banking applications
  • Business applications

7. MySQL in Web Development

MySQL is commonly used as the database layer of web applications.

For example, a PHP application can connect to MySQL and store student registration, login, payment, and course information.

PHP Application
      ↓
    MySQL
      ↓
   Database

8. MySQL Stores Data in Tables

MySQL stores relational data inside tables.

For example:

students

id | name  | course
1  | Rahul | Python
2  | Amit  | Java
3  | Priya | SQL

9. Rows in MySQL

A row represents one complete record in a table.

For example, the following is one student record:

1 | Rahul | Python

This complete line represents one row.

10. Columns in MySQL

A column represents a particular type of information.

id
name
mobile
course
fee

Each column stores a specific type of data.

11. MySQL Database Example

Suppose we create a database named school.

CREATE DATABASE school;

This command creates a new database called school.

12. Selecting a Database

After creating a database, we can select it using the USE command.

USE school;

After this command, SQL statements will operate on the selected database.

13. Creating a Table

Tables are created using the CREATE TABLE statement.

CREATE TABLE students (
    id INT,
    name VARCHAR(100),
    course VARCHAR(100)
);

14. Inserting Data

The INSERT INTO statement adds records to a table.

INSERT INTO students
(id, name, course)
VALUES
(1, 'Rahul', 'Python');

15. Retrieving Data

The SELECT statement is used to retrieve data.

SELECT * FROM students;

The * means all columns.

16. Updating Data

The UPDATE statement modifies existing records.

UPDATE students
SET course = 'Java'
WHERE id = 1;

The WHERE condition identifies the record to update.

17. Deleting Data

The DELETE statement removes records.

DELETE FROM students
WHERE id = 1;

Always use a suitable WHERE condition when deleting specific records.

18. MySQL and PHP

MySQL is frequently used with PHP for developing database-driven websites.

For example:

PHP
 ↓
MySQL Connection
 ↓
Database
 ↓
Tables

19. MySQL and HTML

HTML creates the user interface, while MySQL stores application data.

A typical application may work like this:

HTML Form
    ↓
PHP
    ↓
MySQL
    ↓
Stored Data

20. MySQL and Applications

MySQL can store different types of application data such as:

  • User accounts
  • Student information
  • Product information
  • Orders
  • Payments
  • Attendance
  • Course information

21. MySQL Database Server

MySQL operates as a database server that receives requests from applications or database tools and works with stored data.

Clients can send SQL statements to the MySQL server.

22. MySQL Client

A MySQL client is a tool or application that can connect to a MySQL server.

Examples include:

  • MySQL Workbench
  • MySQL Command Line Client
  • Applications written using programming languages

23. MySQL Workbench

MySQL Workbench is a graphical tool for working with MySQL databases.

It can be used to write SQL queries, manage databases, create tables, and work with database structures.

24. phpMyAdmin and MySQL

phpMyAdmin is a web-based tool commonly used to manage MySQL and compatible database servers.

It provides a graphical interface for creating databases, tables, queries, and records.

25. MySQL and Data Management

MySQL helps applications efficiently manage large amounts of structured data.

Database operations can include creating, reading, updating, and deleting data.

These four operations are commonly called CRUD.

26. What is CRUD?

CRUD represents four basic database operations:

  • C – Create
  • R – Read
  • U – Update
  • D – Delete

MySQL supports these operations through SQL statements.

27. Example of a Student Database

A student management system may contain tables such as:

students
courses
fees
attendance
payments

These tables can be related to each other to build a complete application.

28. Why Learn MySQL?

Learning MySQL is useful for students and developers who want to build database-driven applications.

It is especially useful when working with technologies such as PHP, Python, Java, JavaScript, and other backend technologies.

29. Basic MySQL Workflow

A basic MySQL workflow can be represented as:

1. Create Database
2. Select Database
3. Create Table
4. Insert Data
5. Retrieve Data
6. Update Data
7. Delete Data

This workflow forms the foundation of many database applications.

30. Complete MySQL Example

Here is a simple complete example:

CREATE DATABASE school;

USE school;

CREATE TABLE students (
    id INT,
    name VARCHAR(100),
    course VARCHAR(100)
);

INSERT INTO students
(id, name, course)
VALUES
(1, 'Rahul', 'Python');

SELECT * FROM students;

This example creates a database, selects it, creates a table, inserts a student record, and retrieves the stored data.

📌 Key Points

  • MySQL is a Relational Database Management System.
  • SQL is the language used to communicate with relational databases.
  • MySQL stores structured data in tables.
  • Tables contain rows and columns.
  • MySQL supports CRUD operations.
  • MySQL is widely used in database-driven applications.
  • MySQL Workbench provides a graphical environment for working with MySQL.
  • phpMyAdmin provides a web-based interface for database management.
  • MySQL can be used with PHP and many other programming languages.

🧠 Quick Quiz

Question: What is MySQL?