  We study statistical properties of $N$ non-interacting identical bosons or
fermions in the canonical ensemble. We derive several general representations
for the $p$-point correlation function of occupation numbers
$\overline{n_1\cdots n_p}$. We demonstrate that it can be expressed as a ratio
of two $p\times p$ determinants involving the (canonical) mean occupations
$\overline{n_1}$, ..., $\overline{n_p}$, which can themselves be conveniently
expressed in terms of the $k$-body partition functions (with $k\leq N$). We
draw some connection with the theory of symmetric functions, and obtain an
expression of the correlation function in terms of Schur functions. Our
findings are illustrated by revisiting the problem of Bose-Einstein
condensation in a 1D harmonic trap, for which we get analytical results. We get
the moments of the occupation numbers and the correlation between ground state
and excited state occupancies. In the temperature regime dominated by quantum
correlations, the distribution of the ground state occupancy is shown to be a
truncated Gumbel law. The Gumbel law, describing extreme value statistics, is
obtained when the temperature is much smaller than the Bose-Einstein
temperature.
