Background: Depression symptoms are thought to be associated with lower educational attainment, but patterns of change in attainment among those who receive a clinical diagnosis of depression at any point during childhood and adolescence remain unclear. Methods: We conducted a secondary analysis of an existing data linkage between a national educational dataset (National Pupil Database) and pseudonymised electronic health records (Clinical Record Interactive Search) from a large mental healthcare provider in London, United Kingdom (2007 to 2013). A cohort of 222,027 pupils were included. We used Growth Mixture Modelling (GMM) and stakeholder input to estimate trajectories of standardised educational attainment over School Years 2, 6 and 11. Multinomial logistic regression analyses were then used to investigate the association between resulting educational attainment trajectory membership (outcome) and depression diagnosis any time before age 18 (exposure). Results: A five-trajectory GMM solution for attainment was derived: (1) average/high-stable, (2) average-modest declining, (3) average-steep declining, (4) low-improving and (5) low-stable. After adjusting for clinical and sociodemographic covariates, having a depression diagnosis before age 18 was associated with occupying the average-modest declining trajectory (RRR = 2.80, 95% CI 2.36–3.32, p <.001) or the average-steep declining trajectory (RRR = 3.54, 95% CI 3.10–4.04, p <.001), as compared to the average/high-stable trajectory. Conclusions: Receiving a diagnosis of depression before age 18 was associated with a relative decline in attainment throughout school. While these findings cannot support a causal direction, they nonetheless suggest a need for timely mental health and educational support among pupils struggling with depression.