An in-flight calibration study of the Coronal Diagnostic Spectrometer (CDS) instrument on board SOHO (Solar and Heliospheric Observatory) is presented. The relative intensity calibration of CDS is a fundamental requirement for deriving important physical parameters of the solar transition region and corona from the observations. This comprehensive study provides the first complete in-flight relative calibration of all nine CDS channels, first and second order. This has been achieved with the use of a spectroscopic calibration method, mainly based on the comparison between observed line ratios and theoretical predictions provided by the CHIANTI atomic database. The calibration method has been applied to a large number of observations (on-disc, off-limb, quiet sun, active region), to enable the use of a wide range of spectral lines from low to high temperatures of formation. The results are compared to the pre-launch calibration and other post-launch studies. Significant differences with the ground calibration results are found, while there is good agreement with the post-launch studies, based on rocket flights. It is also shown that the relative calibration has not significantly changed over a long period of time, thus confirming the excellent stability of the CDS instrument.