Skip to content

Latest commit

 

History

History
357 lines (243 loc) · 9.92 KB

File metadata and controls

357 lines (243 loc) · 9.92 KB

Learning Path

A structured guide to learning PDOdb from beginner to advanced.

Overview

This learning path is designed to take you from complete beginner to advanced PDOdb user. Each section builds on the previous one, so follow them in order.

Estimated Time:

  • Beginner: 1-2 hours
  • Intermediate: 3-5 hours
  • Advanced: 5-10 hours

Beginner Path

Perfect for those new to PDOdb or database libraries in general.

Step 1: Installation (15 minutes)

Goal: Get PDOdb installed and verify it works.

Tasks:

  • Install via Composer
  • Verify PDO extensions are installed
  • Create a simple test connection

Resources:

Checkpoint: Can you connect to SQLite and run a simple query?

Step 2: First Connection (20 minutes)

Goal: Understand how to connect to different databases.

Tasks:

  • Connect to SQLite (easiest - no setup)
  • Understand connection configuration
  • Test connection with ping()

Resources:

Checkpoint: Can you connect to at least one database type?

Step 3: Hello World (30 minutes)

Goal: Write your first complete application.

Tasks:

  • Create tables
  • Insert data
  • Query data
  • Update and delete records
  • Understand basic CRUD operations

Resources:

Checkpoint: Can you create a table, insert data, and query it?

Step 4: Query Builder Basics (30 minutes)

Goal: Understand the fluent API and method chaining.

Tasks:

  • Learn find(), from(), where(), get()
  • Understand method chaining
  • Practice building simple queries

Resources:

Checkpoint: Can you build queries using method chaining?

Step 5: Basic CRUD Operations (30 minutes)

Goal: Master Create, Read, Update, Delete operations.

Tasks:

  • Insert single and multiple rows
  • Select with conditions
  • Update records
  • Delete records
  • Understand affected rows

Resources:

Checkpoint: Can you perform all CRUD operations confidently?

Beginner Path Complete! 🎉

You now know the basics. Move on to intermediate topics when you're comfortable with CRUD operations.


Intermediate Path

For those comfortable with basics and ready to learn advanced query building.

Step 1: JOINs (45 minutes)

Goal: Understand how to join multiple tables.

Tasks:

  • Learn INNER JOIN, LEFT JOIN, RIGHT JOIN
  • Understand table aliases
  • Practice joining 2-3 tables
  • Handle NULL values in joins

Resources:

Checkpoint: Can you join multiple tables and get correct results?

Step 2: Aggregations (45 minutes)

Goal: Use GROUP BY, HAVING, and aggregate functions.

Tasks:

  • COUNT, SUM, AVG, MIN, MAX
  • GROUP BY with single and multiple columns
  • HAVING vs WHERE
  • Filtering aggregated results

Resources:

Checkpoint: Can you write queries with aggregations and grouping?

Step 3: Transactions (30 minutes)

Goal: Understand transaction management and data integrity.

Tasks:

  • Start, commit, rollback transactions
  • Use transaction callbacks
  • Handle errors in transactions
  • Understand when to use transactions

Resources:

Checkpoint: Can you wrap multiple operations in a transaction?

Step 4: JSON Operations (45 minutes)

Goal: Work with JSON data across all databases.

Tasks:

  • Store JSON data
  • Query JSON fields
  • Filter by JSON values
  • Update JSON documents

Resources:

Checkpoint: Can you store and query JSON data?

Step 5: Helper Functions (30 minutes)

Goal: Use helper functions for common operations.

Tasks:

  • String helpers (concat, upper, lower)
  • Date helpers (now, curDate)
  • NULL helpers (coalesce, ifNull)
  • Comparison helpers (like, between, in)

Resources:

Checkpoint: Can you use helpers instead of raw SQL for common operations?

Step 6: Error Handling (30 minutes)

Goal: Handle errors gracefully and debug issues.

Tasks:

  • Understand exception hierarchy
  • Catch specific exception types
  • Use error diagnostics
  • Log errors appropriately

Resources:

Checkpoint: Can you handle errors and debug database issues?

Intermediate Path Complete! 🎉

You're now comfortable with most common database operations. Ready for advanced topics?


Advanced Path

For those ready to master advanced features and optimizations.

Step 1: Window Functions (60 minutes)

Goal: Use window functions for advanced analytics.

Tasks:

  • ROW_NUMBER, RANK, DENSE_RANK
  • LAG, LEAD for time-series data
  • Running totals and moving averages
  • Partitioning windows

Resources:

Checkpoint: Can you write queries with window functions?

Step 2: Common Table Expressions (CTEs) (45 minutes)

Goal: Use CTEs for complex queries and recursive operations.

Tasks:

  • Basic CTEs (WITH clauses)
  • Recursive CTEs for hierarchical data
  • Materialized CTEs for performance
  • Multiple CTEs in one query

Resources:

Checkpoint: Can you write recursive CTEs for tree structures?

Step 3: Subqueries (30 minutes)

Goal: Use subqueries effectively.

Tasks:

  • Scalar subqueries
  • EXISTS and NOT EXISTS
  • IN and NOT IN with subqueries
  • Correlated subqueries

Resources:

Checkpoint: Can you use subqueries in SELECT, WHERE, and FROM clauses?

Step 4: Performance Optimization (60 minutes)

Goal: Optimize queries for better performance.

Tasks:

  • Use EXPLAIN and EXPLAIN ANALYZE
  • Create appropriate indexes
  • Understand query execution plans
  • Use query caching
  • Batch processing for large datasets

Resources:

Checkpoint: Can you identify and fix slow queries?

Step 5: Advanced Features (90 minutes)

Goal: Master advanced PDOdb features.

Tasks:

  • Read/Write splitting
  • Sharding across multiple databases
  • Database migrations
  • Query macros and scopes
  • Plugin system

Resources:

Checkpoint: Can you set up read/write splitting or sharding?

Step 6: ActiveRecord Pattern (60 minutes)

Goal: Use the optional ORM for object-based operations.

Tasks:

  • Define models
  • Use relationships (hasOne, hasMany, belongsTo)
  • Eager and lazy loading
  • Model validation
  • Query scopes

Resources:

Checkpoint: Can you build a complete model with relationships?

Advanced Path Complete! 🎉

You're now a PDOdb expert! Continue exploring advanced topics and contributing to the community.


Quick Reference

Need to do something quickly?

Not sure where to start?

  1. Complete beginner? → Start with Installation
  2. Know SQL but new to PDOdb? → Start with Hello World
  3. Want to learn a specific feature? → Use the search or table of contents
  4. Having issues? → Check Troubleshooting

Learning Tips

  • Practice: Type out examples yourself, don't just read them
  • Experiment: Modify examples to see what happens
  • Build: Create a small project to practice
  • Read: Check the Best Practices section regularly
  • Ask: Use GitHub Issues for questions

Next Steps

After completing your path: