A survey is presented of theoretical and experimental studies of inelastic scattering of X-rays and gamma rays by electrons in inner atomic shells. The photon energy range from 2 keV to about 1 MeV is considered. The main focus is on both non-resonant and resonant inelastic scattering by strongly bound electrons. Applications of the results to studies of X-ray attenuation and transport in condensed matter, and of selected topics in solid state physics are also briefly pointed out. Theoretical treatments of the different processes are described. Limitations of simpler treatments of Compton scattering relying on the A2 approximation, the impulse approximation and the incoherent scattering function approximation are explained in the context of the relativistic second order S matrix approach. Additional aspects of inelastic processes such as double Compton scattering, electron magnetic moment dependent scattering, and scattering by plasmons and phonons are mentioned briefly but not reviewed. Comments are made regarding experimental details concerning sources, methods of monochromatisation, choices of targets, detectors, coincidence techniques and scattering arrangements, and estimation of false counts. Extensive tables listing different types of experiments are presented. The experimental data are discussed from the standpoint of the best available calculations. Possible directions of further progress are indicated.