Coding · Grade 12
Data Models and Persistent State
Learners design the data layer of a capstone: entities, primary and foreign keys, one-to-many and many-to-many relationships with link tables, and normalisation to avoid update, insertion and deletion anomalies. They query real in-memory SQLite databases with SELECT, JOIN, GROUP BY and IS NULL from Python, and persist state safely with serialisation round trips, transactions, parameterised queries and planned migrations.
- 4 lessons
- About 105 minutes
- Check what you learned: 8 questions
- Ways to answer: choose an answer, trace code, match pairs, type a number, sort into groups and true or false
What learners will discover
- Model data with entities, attributes, primary and foreign keys, and one-to-many and many-to-many relationships.
- Normalise data so each fact is stored once, avoiding update, insertion and deletion anomalies.
- Query relational data with SELECT, WHERE, JOIN, GROUP BY, ORDER BY and IS NULL.
- Persist state safely using serialisation, transactions, parameterised queries and planned migrations.
Lessons
-
Modelling data 5 steps2 practiceabout 22 min
-
Normalisation 5 steps3 practiceabout 20 min
-
Querying with SQL 5 steps3 practiceabout 24 min
-
Persisting state safely 4 steps3 practiceabout 20 min
-
Check what you learned 8 questions at the end
Keep exploring
More 12th grade coding
- 12th Grade Coding Worksheets10 printable worksheets
Guide for grown-ups
- How to start homeschooling: a step-by-step guide for familiesA guide for parents · 7 min read