MySQL Basics – Study Notes
1. What is MySQL
MySQL is an open-source Relational Database Management System (RDBMS) that uses
Structured Query Language (SQL) to manage and manipulate data. It is widely used in web
applications and enterprise systems due to its reliability, performance, and ease of use.
2. Features of MySQL
• Open-source and free to use
• High performance and scalability
• Supports large databases
• ACID compliant with transactional storage engines (InnoDB)
• Secure with user authentication and access control
• Cross-platform support (Windows, Linux, macOS)
• Supports indexing, views, triggers, and stored procedures
3. Database
A database is an organized collection of data that can be easily accessed, managed, and
updated. Databases store data in a structured format and allow efficient retrieval using queries.
4. RDBMS (Relational Database Management System)
An RDBMS stores data in the form of tables (relations). Each table consists of rows (records)
and columns (attributes). Relationships between tables are maintained using keys such as
primary keys and foreign keys.
5. Database Operations
Create Database
CREATE DATABASE database_name;
Show Databases
SHOW DATABASES;
Delete / Drop Database
DROP DATABASE database_name;
6. Table Operations
Create Table
CREATE TABLE table_name (
column1 datatype,
column2 datatype
);
Show Tables
SHOW TABLES;
Insert Data into Table
INSERT INTO table_name VALUES (value1, value2);
INSERT INTO table_name (col1, col2) VALUES (value1, value2);
Drop Table
DROP TABLE table_name;
7. SELECT Query Clauses
WHERE Clause
Used to filter records based on a condition.
SELECT * FROM table_name WHERE condition;
DISTINCT Keyword
Used to remove duplicate values from the result set.
SELECT DISTINCT column_name FROM table_name;
LIMIT Clause
Used to restrict the number of rows returned.
SELECT * FROM table_name LIMIT number;
ORDER BY Clause
Used to sort the result set in ascending or descending order.
SELECT * FROM table_name ORDER BY column_name ASC|DESC;
These notes cover the fundamental MySQL concepts required for beginners and
undergraduate students.