  We present exact expressions for certain integrated correlators of four
superconformal primary operators in the stress tensor multiplet of
$\mathcal{N}=4$ supersymmetric Yang--Mills (SYM) theory with classical gauge
group, $G_N$ $= SO(2N)$, $SO(2N+1)$, $USp(2N)$. These integrated correlators
are expressed as two-dimensional lattice sums by considering derivatives of the
localised partition functions, generalising the expression obtained for $SU(N)$
in our previous works. These expressions are manifestly covariant under
Goddard-Nuyts-Olive duality. The integrated correlators can also be formally
written as infinite sums of non-holomorphic Eisenstein series with integer
indices and rational coefficients. Furthermore, the action of the hyperbolic
Laplace operator with respect to the complex coupling $\tau=\theta/(2\pi) +
4\pi i /g^2_{_{YM}}$ on any integrated correlator for gauge group $G_N$ relates
it to a linear combination of correlators with gauge groups $G_{N+1}$, $G_N$
and $G_{N-1}$. These "Laplace-difference equation" determine the expressions of
integrated correlators for all classical gauge groups for any value of $N$ in
terms of the correlator for the gauge group $SU(2)$. The perturbation
expansions of these integrated correlators for any finite value of $N$ agree
with properties obtained from perturbative Yang--Mills quantum field theory,
together with various multi-instanton calculations which are also shown to
agree with those determined by supersymmetric localisation. The coefficients of
terms in the large-$N$ expansion are sums of non-holomorphic Eisenstein series
with half-integer indices, which extend recent results and make contact with
low order terms in the low energy expansion of type IIB superstring theory in
an $AdS_5\times S^5/\mathbb{Z}_2$ background.
