45-Day SQL Mastery Plan
Objective
- Master SQL in 45 days, starting with no prior knowledge.
- Dedicate 1 hour each day to learning and practicing SQL.
- Use the provided document "SQL👀.pdf" as the primary resource, which includes daily topics,
examples, practice questions, and datasets.
Prerequisites
- Set up a SQL environment : Install a local database like MySQL or SQLite, or use an online SQL
editor (e.g., SQL Fiddle) for hands-on practice. Spend your first hour setting this up if needed.
- Access datasets : The document references datasets for each day (e.g., "Click Here to View Dataset
in Excel Sheet"). Ensure you can access these for practice—download them or prepare to work with
them in your SQL environment.
---
Daily Breakdown
Weeks 1-3 (Days 1-21): Core SQL Topics
Focus on building a solid foundation with essential SQL concepts.
- Day 1: Introduction to SQL and Relational Databases
- Learn what SQL is and its role in managing databases.
- Study relational database components (tables, rows, columns, keys).
- Resource: Day 1 in the document.
- Day 2: Basic SQL Commands
- Learn `SELECT`, `INSERT`, `UPDATE`, and `DELETE`.
- Practice writing simple queries using the Day 1 dataset.
- Example: Write a query to retrieve all columns from the "customers" table.
- Day 3: Practice Basic Queries
- Write queries to retrieve, insert, update, and delete data.
- Use practice questions from Day 1:
1. Insert a record into "employees".
2. Update "quantity" in "products".
3. Delete records from "orders".
- Day 4: Filtering Data with `WHERE`
- Learn the `WHERE` clause for filtering data.
- Practice with conditions like `=`, `>`, `<`, `AND`, `OR`.
- Resource: Day 2 in the document.
- Day 5: Practice Filtering
- Solve practice questions from Day 2:
1. Filter "products" by category and price.
2. Retrieve customer names alphabetically.
3. Count total orders.
- Day 6: Sorting Data with `ORDER BY`
- Learn to sort query results using `ORDER BY`.
- Practice ascending and descending sorts.
- Resource: Day 2 in the document.
- Day 7: Practice Sorting
- Combine `ORDER BY` with `WHERE`.
- Experiment with sorting by multiple columns using the Day 2 dataset.
- Day 8: Introduction to Joining Tables
- Learn about table joins and start with `INNER JOIN`.
- Resource: Day 3 in the document.
- Example: Join "customers" and "orders" on "customer_id".
- Day 9: Practice `INNER JOIN`
- Write queries with `INNER JOIN`.
- Use practice questions from Day 3:
1. Join "products", "categories", and "suppliers".
2. Join "employees" and "departments".
3. Join "customers" and "orders" with a condition.
- Day 10: Other Join Types
- Learn `LEFT JOIN`, `RIGHT JOIN`, and `FULL JOIN`.
- Understand their use cases.
- Resource: Day 3 in the document.
- Day 11: Practice Other Joins
- Write queries using `LEFT`, `RIGHT`, and `FULL JOIN`.
- Revisit Day 3 practice questions and experiment with join types.
- Day 12: Aggregating Data
- Learn aggregate functions: `COUNT`, `SUM`, `AVG`, `MAX`, `MIN`.
- Resource: Day 4 in the document.
- Example: Count orders per customer.
- Day 13: Practice Aggregating Data
- Solve practice questions from Day 4:
1. Average price per category.
2. Max salary per department.
3. Total revenue per customer.
- Day 14: Grouping Data with `GROUP BY`
- Learn to group data and use `HAVING`.
- Resource: Day 4 in the document.
- Example: Group orders by customer with a condition.
- Day 15: Practice `GROUP BY`
- Write queries with `GROUP BY` and `HAVING`.
- Use Day 4 dataset and practice questions.
- Day 16: Advanced Filtering
- Learn `LIKE`, `IN`, `BETWEEN`, and handling `NULL`.
- Resource: Day 6 in the document.
- Example: Filter customers with names starting with 'J'.
- Day 17: Practice Advanced Filtering
- Solve practice questions from Day 6:
1. Filter products by price range.
2. Filter employees by hire date.
3. Find customers with no phone number.
- Day 18: SQL Functions
- Learn string, date, and numeric functions (e.g., `UPPER`, `CURRENT_DATE`, `ROUND`).
- Resource: Day 7 in the document.
- Example: Get the length of product names.
- Day 19: Practice SQL Functions
- Solve practice questions from Day 7:
1. Get current date/time.
2. Uppercase employee names.
3. Apply a discount to product prices.
- Day 20: Introduction to Subqueries
- Learn subqueries in `SELECT`, `WHERE`, and `FROM`.
- Resource: Day 8 in the document.
- Example: Find products above average price.
- Day 21: Practice Subqueries
- Solve practice questions from Day 8:
1. Employees with above-max salary.
2. Customers with recent orders.
3. Categories with many products.
Weeks 4-6 (Days 22-42): Advanced SQL Topics
Build on your foundation with more complex concepts.
- Day 22: Views and Indexes
- Learn to create views and indexes for optimization.
- Resource: Day 9 in the document.
- Example: Create a view for high-salary employees.
- Day 23: Practice Views and Indexes
- Solve practice questions from Day 9:
1. Create an "order_summary" view.
2. Index the "email" column.
3. Create a "product_inventory" view.
- Day 24: Data Integrity and Constraints
- Learn `NOT NULL`, `UNIQUE`, `PRIMARY KEY`, `FOREIGN KEY`.
- Resource: Day 10 in the document.
- Example: Create an "employees" table with constraints.
- Day 25: Practice Constraints
- Solve practice questions from Day 10:
1. Create an "orders" table with a foreign key.
2. Create a "products" table with constraints.
3. Create a "categories" table.
- Day 26: Modifying Tables
- Learn `ALTER TABLE`, `DROP TABLE`, `RENAME TABLE`.
- Resource: Day 11 in the document.
- Example: Add an "address" column to "employees".
- Day 27: Practice Modifying Tables
- Solve practice questions from Day 11:
1. Rename a table.
2. Drop a column.
3. Change a column’s data type.
- Day 28: Advanced Joins and Subqueries
- Learn self-joins, non-equijoins, and correlated subqueries.
- Resource: Day 12 in the document.
- Example: Self-join "employees" to find managers.
- Day 29: Practice Advanced Joins and Subqueries
- Solve practice questions from Day 12:
1. Find orders with no items.
2. Join "products" and "order_items".
3. Match order and registration dates.
- Day 30: Transactions and Locking
- Learn transactions (ACID properties) and locking.
- Resource: Day 13 in the document.
- Example: Update "inventory" with a transaction.
- Day 31: Practice Transactions
- Solve practice questions from Day 13:
1. Roll back an order deletion.
2. Update an account balance.
3. Lock a row in "employees".
- Day 32: Stored Procedures
- Learn to create and use stored procedures.
- Resource: Day 14 in the document.
- Example: Create a procedure to get customer orders.
- Day 33: Practice Stored Procedures
- Solve practice questions from Day 14:
1. Create an "update_inventory" trigger (adapt as a procedure).
2. Create a "calculate_discount" function (adapt as a procedure).
3. Optimize a query (focus on procedure creation).
- Day 34: Triggers
- Learn to create triggers for automation.
- Resource: Day 14 in the document.
- Example: Create an "update_inventory" trigger.
- Day 35: Practice Triggers
- Adapt Day 14 practice questions for triggers:
1. Trigger for order placement.
2. Trigger for discount calculation.
3. Trigger for query optimization (focus on trigger logic).
- Day 36: Advanced Querying
- Deepen subquery and nested query skills.
- Resource: Day 15 in the document.
- Example: Find customers with purchases.
- Day 37: Practice Advanced Querying
- Solve practice questions from Day 15:
1. Customers with purchases.
2. Customers without purchases.
3. Orders above average quantity.
- Day 38: Joins in Depth
- Explore multi-table and advanced joins.
- Resource: Day 16 in the document.
- Example: Join "orders" with customer names.
- Day 39: Practice Joins
- Solve practice questions from Day 16:
1. Join orders with customers and products.
2. Join products and suppliers.
3. Find customers with no orders.
- Day 40: Advanced Filtering and Sorting
- Learn wildcards and sorting with `NULL`.
- Resource: Day 17 in the document.
- Example: Filter employees starting with 'J'.
- Day 41: Practice Advanced Filtering and Sorting
- Solve practice questions from Day 17:
1. Names starting with 'A' and ending with 'n'.
2. Products with digits in names.
3. Sort employees by salary with `NULL` handling.
- Day 42: Aggregations and Grouping
- Master advanced aggregation and grouping.
- Resource: Day 18 in the document.
- Example: Total order amount per customer.
Final Days (Days 43-45): Review and Practice
Consolidate your knowledge and tackle complex queries.
- Day 43: Review Core Topics
- Revisit Days 1-21: `SELECT`, joins, aggregations, etc.
- Practice with earlier datasets and questions.
- Day 44: Review Advanced Topics
- Revisit Days 22-42: subqueries, transactions, stored procedures.
- Combine concepts in practice queries.
- Day 45: Final Practice and Assessment
- Write complex queries integrating multiple concepts (e.g., joins, subqueries, aggregations).
- Use practice questions from Days 23-24 (e.g., recursive queries, performance optimization).
---
Key Tips for Success
- Practice daily : Spend your hour writing queries with the provided datasets and practice questions.
Hands-on practice is essential.
- Understand concepts : Focus on how things work (e.g., how joins match data, why indexes speed
up queries) rather than just memorizing syntax.
- Use resources : Refer to the document’s links (e.g., w3schools.com, sqlshack.com) for clarity.
They’re listed under each day’s resources.
- Seek help if stuck : If a concept is unclear, revisit the document or ask for clarification (you can ask
me!).
- Stay consistent : With only 1 hour daily, focus is critical—stick to the schedule.
- Post-45 days : Solve SQL problems on LeetCode or HackerRank to further enhance your skills.
---
Additional Notes
- SQL dialect : The document uses standard SQL. If using MySQL or PostgreSQL, note minor syntax
differences (e.g., string functions).
- Database design : Day 22 introduces data modeling and normalization—crucial for understanding
table relationships.
- Time management : Spend ~30 minutes learning the day’s topic and ~30 minutes practicing with
the dataset and questions.
---
This plan ensures you cover all SQL essentials within 45 days, balancing learning and practice. By
following it diligently with the document’s resources, you’ll go from zero to proficient in SQL
efficiently. Happy learning!