MySQL Exam Notes
1. Basics of MySQL
• Features: Open-source RDBMS, fast, secure, multi-user support, cross-platform.
• Data Types: INT, FLOAT, CHAR, VARCHAR, TEXT, DATE, DATETIME.
• Primary Key: Unique, Not NULL, one per table.
• Foreign Key: Links tables, maintains referential integrity.
• SQL vs MySQL: SQL is a query language, MySQL is database software.
2. Database Design & Normalization
• 1NF: Atomic values, no repeating groups.
• 2NF: No partial dependency.
• 3NF: No transitive dependency.
• Relationships: One-to-One, One-to-Many, Many-to-Many.
• Constraints: NOT NULL, UNIQUE, CHECK, PRIMARY KEY, FOREIGN KEY.
3. SQL Queries
• SELECT statement to retrieve data.
• WHERE clause with LIKE, BETWEEN, IN.
• ORDER BY for sorting data.
• GROUP BY for grouping records.
• HAVING for condition on grouped data.
• Aggregate Functions: COUNT, SUM, AVG, MIN, MAX.
4. Joins & Subqueries
• INNER JOIN: Returns matching records.
• LEFT JOIN: All left table records.
• RIGHT JOIN: All right table records.
• FULL JOIN: Use UNION in MySQL.
• Self Join: Table joined with itself.
• Subqueries: Single-row, Multi-row, Correlated.
5. Data Manipulation
• INSERT: Add new records.
• UPDATE: Modify records.
• DELETE: Remove records.
• Transactions: COMMIT, ROLLBACK, SAVEPOINT.
• AUTO_INCREMENT: Auto increases primary key value.
6. Advanced Features
• Views: Virtual tables based on queries.
• Indexes: Improve search performance.
• Stored Procedures: Reusable SQL code blocks.
• Triggers: Auto-executed on INSERT/UPDATE/DELETE.
7. Security & Administration
• User Management: CREATE USER, GRANT, REVOKE.
• Backup using mysqldump command.
• Restore using mysql command with backup file.