Quiz on AI Interviews Prep Live Training Corporate Training

MySQL Introduction.

1. What is MySQL?

MySQL is an open-source Relational Database Management System (RDBMS) used to store, manage, and retrieve data.

It uses SQL (Structured Query Language) to interact with databases.

2. Features of MySQL

  • Open-source and free
  • Fast and reliable
  • Supports large databases
  • Works with PHP, Python, Java, and more
  • Secure and scalable

3. Database Basics

  • Database: Collection of related data
  • Table: Data arranged in rows and columns
  • Row: A single record
  • Column: A data field

4. Creating a Database


CREATE DATABASE school;
    

5. Selecting a Database


USE school;
    

6. Creating a Table


CREATE TABLE students (
    id INT PRIMARY KEY,
    name VARCHAR(50),
    age INT,
    marks INT
);
    

7. Inserting Data


INSERT INTO students VALUES
(1, 'Alice', 15, 85),
(2, 'Bob', 16, 90);
    

8. Viewing Data


SELECT * FROM students;
    

9. Using WHERE Clause


SELECT * FROM students
WHERE marks > 80;
    

10. Updating Data


UPDATE students
SET marks = 95
WHERE id = 2;
    

11. Deleting Data


DELETE FROM students
WHERE id = 1;
    

12. Sorting and Limiting Results


SELECT * FROM students
ORDER BY marks DESC
LIMIT 1;
    

13. Aggregate Functions

Function Description
COUNT() Counts number of rows
SUM() Adds values
AVG() Calculates average
MAX() Finds maximum value
MIN() Finds minimum value

14. Example of Aggregate Query


SELECT AVG(marks) FROM students;
    

15. Applications of MySQL

  • Web applications
  • School and college databases
  • E-commerce websites
  • Content management systems