We present a novel approach for computing the Hilbert series of 4d N=1
supersymmetric QCD with SO(N_c) and Sp(N_c) gauge groups. It is shown that such
Hilbert series can be recast in terms of determinants of Hankel matrices. With
the aid of results from random matrix theory, such Hankel determinants can be
evaluated both exactly and asymptotically. Several new results on Hilbert
series for general numbers of colours and flavours are thus obtained in this
paper. We show that the Hilbert series give rise to families of rational
solutions, with palindromic numerators, to the Painlev\'e VI equations. Due to
the presence of such Painlev\'e equations, there exist integrable Hamiltonian
systems that describe the moduli spaces of SO(N_c) and Sp(N_c) SQCD. To each
system, we explicitly state the corresponding Hamiltonian and family of
elliptic curves. It turns out that such elliptic curves take the same form as
the Seiberg-Witten curves for 4d N=2 SU(2) gauge theory with 4 flavours.Comment: 45 pages, 3 table