learning-it by example

Back to the video

Many-to-Many Relationships and Bridge Tables

Four students' fees add up to 3,200 pounds; summed after joining through a bridge table they came out as 5,500.

Video #255 ยท Data modelling

Steps in the video

  1. 0:00 Fees of 3,200 pounds became 5,500 after joining.
  2. 0:32 The idea
  3. 1:00 Setup
  4. 1:20 The data
  5. 1:44 The bridge table
  6. 2:15 Walking the bridge
  7. 2:30 Who is missing, and a repeat
  8. 2:41 Run the bridge
  9. 3:08 The double counting trap
  10. 3:37 Run the trap
  11. 4:13 What this does not show
  12. 4:52 Mistakes to avoid
  13. 5:29 My take and next steps
  14. 6:00 Recap

Files

  • run.py (49 lines)
  • school.py (35 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

Four made-up students in SQLite; the Power BI example is quoted, not run, and no indexes or speed are measured.

Sources

Learning IT by Example.