-- Getting a subsample of the data.
-- Uses the integer short object id (obj) and the '%' syntax (like awk) 
-- to get every 100000th object. THIS IS NOT A TRULY RANDOM SUBSET!
-- 
-- Returns 386 objects in (in about 2min).

SELECT objID, dec, gmag, rmag, imag, zmag, ymag
FROM Galaxy with (nolock)
WHERE (objID%100000) = 1 
   AND (rmag between 18 and 21)
ORDER BY dec -- shows that it covers the whole declination range
