F05 Stage A · Foundations 28 h (10 T / 18 P)
Databases & SQL for AI Systems
Models, queries and tunes relational data for AI workloads.
Prerequisite
F01
Modules
4
NOS
SSC/N9004
Statutory mapping
—
Tech stack
PostgreSQLSQLAlchemy
Modules
4 modules · 28 hours
M1 · Relational modelling
7 h TOPICS
- Relational model
- Keys
- Normalisation
- Schema design
- Data types
- Constraints
- Indexing fundamentals
Lab: Design a normalised schema for a transactional domain
Course material for this module is in production.
M2 · SQL
9 h TOPICS
- SELECT and filtering
- Joins (inner, outer, self)
- Aggregation
- GROUP BY and HAVING
- Subqueries
- CTEs
- Window functions
Lab: Analytical query set of 20 graded problems
Course material for this module is in production.
M3 · Query performance
6 h TOPICS
- Execution plans
- Index selection
- Cardinality
- Partitioning
- Avoiding N+1 access patterns
Lab: Reduce a slow query's runtime by an order of magnitude
Course material for this module is in production.
M4 · Programmatic access
6 h TOPICS
- SQLAlchemy and drivers
- Connection pooling
- Transactions and isolation
- NoSQL and vector-store preview
Lab: Parameterised, pooled data-access layer
Course material for this module is in production.
Real-world work scenario
A nightly aggregation job has grown from 4 minutes to 90 minutes. Read the execution plan, identify the missing composite index and the accidental cross join, fix both, and document the before and after.
Assessment
SQL challenge set · query-tuning practical