After adjustment for age [adjusted odds ratio (AOR) for 10 years: 1.03; 95% confidence interval (CI): 0.99‐1.07; P = .1211], sex [AOR for female: 1.39; 95% CI: 1.26‐1.53; P < .0001], hemoglobin A1c [AOR for 1.0%: 1.18; 95% CI: 1.11‐1.26; P < .0001], duration of T2DM [AOR for 1 year: 1.00; 95% CI: 0.99‐1.01; P = .4089], and history of seven medical conditions, the odds ratios for the development of depression was significantly lower for dipeptidyl peptidase‐4 (DPP‐4) inhibitors [AOR: 0.31; 95% CI: 0.24‐0.42; P < .0001]. The gene discussed is DPP4; the disease is major depressive disorder.