We have studied four complex organic molecules (COMs), the oxygen-bearing methyl formate (CH3OCHO) and dimethyl ether (CH3OCH3) as well as the nitrogen-bearing formamide (NH2CHO) and ethyl cyanide (C2H5CN), towards a large sample of 39 high-mass star-forming regions representing different evolutionary stages, from early to evolved phases. We aim to identify potential correlations and chemical links between the molecules and to trace their evolutionary sequence through the star formation process. We analysed spectra obtained at 3, 2, and 0.9 mm with the IRAM-30m telescope. We derived the main physical parameters for each species by fitting the molecular lines. We compared them and evaluated their evolution while also taking several other interstellar environments into account. We report detections in 20 sources, revealing a clear dust absorption effect on column densities. Derived abundances range between ~ 10−10−10−7 for CH3OCHO and CH3OCH3, ~ 10−12−10−10 for NH2CHO, and ~ 10−11−10−9 for C2H5CN. The abundances of CH3OCHO, CH3OCH3, and C2H5CN are very strongly correlated (r ≥ 0.92) across ~ 4 orders of magnitude. We note that CH3OCHO and CH3OCH3 show the strongest correlations in most parameters, and a nearly constant ratio (~ 1) over a remarkable ~ 9 orders of magnitude in luminosity for the following wide variety of sources: pre-stellar to evolved cores, low- to high-mass objects, shocks, Galactic clouds, and comets. This indicates that COMs chemistry is likely early developed and then preserved through evolved phases. Moreover, the molecular abundances clearly increase with evolution, covering ~ 6 orders of magnitude in the luminosity/mass ratio. We consider CH3OCHO and CH3OCH3 to be most likely chemically linked. They could, for example, share a common precursor, or be formed one from the other. Based on correlations, ratios, and the evolutionary trend, we propose a general scenario for all COMs, involving a formation in the cold, earliest phases of star formation and a following increasing desorption with the progressive thermal and shock-induced heating of the evolving core.