  We derive stellar metallicities, light-weighted ages and stellar masses for a
magnitude-limited sample of 175,128 galaxies drawn from the Sloan Digital Sky
Survey Data Release Two (SDSS DR2). We compute median-likelihood estimates of
these parameters using a large library of model spectra at medium-high
resolution, covering a comprehensive range of star formation histories. The
constraints we derive are set by the simultaneous fit of five spectral
absorption features, which are well reproduced by our population synthesis
models. By design, these constraints depend only weakly on the alpha/Fe element
abundance ratio. Our sample includes galaxies of all types spanning the full
range in star formation activity, from dormant early-type to actively
star-forming galaxies. We show that, in the mean, galaxies follow a sequence of
increasing stellar metallicity, age and stellar mass at increasing 4000AA-break
strength (D4000). For galaxies of intermediate mass, stronger Balmer absorption
at fixed D4000 is associated with higher metallicity and younger age. We
investigate how stellar metallicity and age depend on total galaxy stellar
mass. Low-mass galaxies are typically young and metal-poor, massive galaxies
old and metal-rich, with a rapid transition between these regimes over the
stellar mass range 3x10^9<M/Msun<3x10^10. Both high- and low-concentration
galaxies follow these relations, but there is a large dispersion in stellar
metallicity at fixed stellar mass, especially for low-concentration galaxies of
intermediate mass. Despite the large scatter, the relation between stellar
metallicity and stellar mass is similar to the correlation between gas-phase
oxygen abundance and stellar mass for star-forming galaxies. [abriged]
