Free learning path

From Python functions to real database queries

A short route through three connected topics. Read an example, solve a question yourself, and check the answer before moving on.

1. Start with functions

In Python, practice passing inputs into a function and returning a result. Use the functions study note to build a small study-hours calculator. Write two tests: one for a normal session and one for an empty list. The goal is to understand a reusable calculation, not to memorize the example.

2. Fetch the right Django records

Once you can read a function, learn how a view might fetch one user's notes. In the QuerySet note, compare a query built with filter(user=request.user) to one without that condition. Ask which notes each could show. Then write a list query that orders the user's notes from newest to oldest. Check when the QuerySet actually talks to the database.

3. Understand how rows connect

A Django relationship is easier to debug when you can picture its underlying tables. Work through the SQL joins note. Predict which rows appear with INNER JOIN and with LEFT JOIN, including a student with no study sessions. Then calculate a per-student session count and explain why COUNT(sessions.student_id) handles an unmatched row correctly.

A repeatable week of study

  1. Day 1: read functions, type the example, answer the two tasks.
  2. Day 2: explain parameters and returns without opening the page.
  3. Day 3: read QuerySets and draw how a note belongs to a user.
  4. Day 4: write a current-user query; check it with your own data.
  5. Day 5: read joins and predict each result before looking at the answer.
  6. Day 6: make one personal study note summarizing the links between the three topics.
  7. Day 7: revisit only the questions you missed. A focus timer can help you set a short review window.

If you get stuck, turn a line of code into a specific question first. The notes-to-practice guide shows how; limited free AI help is optional.