โ˜ฐ
โฎ
โฏ

MySQL

Introduction to MySQL

MySQL SQL Basics

MySQL Functions & Operators

MySQL Joins & Unions

MySQL Grouping & Filtering

Database & Table Management

MySQL Constraints

Date & Views

References

MySQL

Introduction to MySQL

MySQL SQL Basics

MySQL Functions & Operators

MySQL Joins & Unions

MySQL Grouping & Filtering

Database & Table Management

MySQL Constraints

Date & Views

References

MySQL Introduction


๐Ÿ”น What is MySQL?

MySQL is an open-source relational database management system (RDBMS). It is used to store, manage, and retrieve data for web applications and enterprise software.

MySQL is developed, distributed, and supported by Oracle Corporation and is one of the most popular databases used with PHP, Java, and Python.


๐Ÿ”น Why Use MySQL?

  • Open-source and free to use

  • Fast, reliable, and scalable

  • Supports large databases and complex queries

  • Integrates well with PHP and web servers

  • Powerful SQL language support for querying and managing data


๐Ÿ”น What is SQL?

SQL (Structured Query Language) is the standard language used to communicate with MySQL databases. SQL allows you to:

  • Create and modify database structures (tables, columns)

  • Insert, update, delete, and query data

  • Manage users, permissions, and transactions


๐Ÿ”น Basic MySQL Syntax Example

SELECT * FROM customers;
 
 

This command retrieves all records from the customers table.


๐Ÿ”น Common SQL Commands in MySQL

Command Description
SELECT Retrieve data from a table
INSERT INTO Add new data into a table
UPDATE Modify existing data
DELETE Remove records
CREATE TABLE Define a new table
ALTER TABLE Modify table structure
DROP TABLE Delete a table

๐Ÿ”น Connecting MySQL with PHP

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";

$conn = mysqli_connect($servername, $username, $password, $dbname);

if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
 

Practice Questions

Q1. Create a table for storing student records

Q2. Insert a record into the students table

Q3. Retrieve all records from the students table

Q4. Update a student's grade

Q5. Delete a student from the table


MySQL Introduction Quiz

Q1: What does MySQL stand for?

A. My Secure Query Language
B. My Structured Query Language
C. My Sequel
D. Nothing โ€” itโ€™s just a name

Q2: Which SQL statement is used to extract data from a database?

A. GET
B. SELECT
C. EXTRACT
D. OPEN

Q3: Which of the following is used to add a new record?

A. ADD
B. INSERT
C. PUT
D. SAVE

Q4: What is the default port for MySQL?

A. 1433
B. 1521
C. 3306
D. 8080

Q5: Which clause is used to filter records in SQL?

A. ORDER BY
B. WHERE
C. FROM
D. HAVING

Go Back Top