SQL / MySQL
SQL / MySQL
Section titled “SQL / MySQL”Complete MySQL preparation notes covering queries, joins, schema design, indexing, and interview questions.
Learning Path
Section titled “Learning Path”flowchart TB Start[Start Here 🚀] --> Basics[Database Basics<br/>Architecture, Data Types] Basics --> Querying[Querying Data<br/>CRUD, Aggregations, Subqueries] Querying --> Joins[SQL Joins<br/>INNER, LEFT, RIGHT, SELF] Joins --> Perf[Performance & Transactions<br/>Indexing, ACID, Isolation] Perf --> Prog[Programmability<br/>Procedures, Functions, Triggers] Prog --> Admin[Administration & Scaling<br/>Users, Backups, Replication] Admin --> Interview[Interview Prep<br/>QA, Cheatsheet]
style Start fill:#7c3aed,color:#fff style Basics fill:#3b82f6,color:#fff style Querying fill:#059669,color:#fff style Joins fill:#06b6d4,color:#fff style Perf fill:#f59e0b,color:#fff style Prog fill:#ec4899,color:#fff style Admin fill:#10b981,color:#fff style Interview fill:#ef4444,color:#fffSections
Section titled “Sections”🏗️ Database Basics
Section titled “🏗️ Database Basics”- Database & RDBMS Basics — What is a database, SQL sublanguages
- MySQL Architecture — Client-server, InnoDB vs MyISAM
- Data Types — Numeric, string, date types
- Keys & Constraints — PK, FK, unique, composite keys, ON DELETE/UPDATE
- Normalization — 1NF, 2NF, 3NF, BCNF with examples
🔍 Querying Data
Section titled “🔍 Querying Data”- CRUD Operations — INSERT, SELECT, UPDATE, DELETE
- Aggregations & Functions — COUNT, SUM, AVG, string/date functions
- Subqueries & CTEs — Scalar, correlated, recursive CTEs
- Views — Virtual tables, updatable views, WITH CHECK OPTION
- Window Functions — ROW_NUMBER, RANK, DENSE_RANK, LAG/LEAD
- Set Operations — UNION, INTERSECT, EXCEPT
- CASE & Conditional Logic — CASE WHEN, COALESCE, NULLIF
- Query Execution Order — FROM → WHERE → GROUP BY → HAVING → SELECT
- NULL Handling — NULL traps, comparisons, aggregates, NOT IN
🔗 Joins
Section titled “🔗 Joins”- Joins Overview — Visual guide to all join types
- INNER JOIN — Only matched rows from both tables
- LEFT JOIN — All left rows + matched right
- RIGHT JOIN — All right rows + matched left
- FULL OUTER JOIN — All rows from both (MySQL UNION workaround)
- CROSS JOIN — Every combination (Cartesian product)
- SELF JOIN — Table joined to itself
- Exclusion Joins — Anti-join patterns (NOT IN, NOT EXISTS)
- JOIN Conditions & Pitfalls — Common JOIN mistakes
⚡ Performance & Transactions
Section titled “⚡ Performance & Transactions”- Indexing — B-Tree, clustered vs non-clustered, covering indexes
- EXPLAIN & Query Optimization — Reading EXPLAIN, access types
- Performance Optimization — Query, schema, and config optimization
- Transactions & ACID — ACID, COMMIT, ROLLBACK, SAVEPOINT
- Isolation Levels & Deadlocks — 4 levels, anomalies, deadlock prevention
- Locks — Shared/exclusive, row-level vs table-level
⚙️ Programmability
Section titled “⚙️ Programmability”- Stored Procedures & Functions — CREATE PROCEDURE, control flow, functions
- Triggers — BEFORE/AFTER INSERT/UPDATE/DELETE
🛠️ Administration & Scaling
Section titled “🛠️ Administration & Scaling”- Users & Privileges — CREATE USER, GRANT/REVOKE, roles
- Backup & Restore — mysqldump, logical vs physical backups
- Replication — Primary → replica, read scaling, binary logs
- Partitioning & Sharding — Table partitioning, horizontal sharding
- JSON & Full-Text Search — JSON columns, FULLTEXT indexes, MATCH AGAINST
📖 Interview & Revision
Section titled “📖 Interview & Revision”- MySQL Interview Prep — Comprehensive Q&A with visuals
- Common Interview Questions — Top interview questions with solutions
- Quick Revision Cheat Sheet — Quick reference for revision
- Quick Reference Summary — Summary of key SQL concepts
- Choosing the Right Join — Decision guide for join types
- JOIN Conditions & Pitfalls — Common JOIN mistakes and fixes