-- Getting a subsample of the data.
--
-- Uses the integer short object id (obj) - which is the least significant bits
-- of the long objID - and the '%' operator (remainder)  to get every 1000th 
-- object. 

-- NOTE: THIS IS NOT A TRULY RANDOM SAMPLE!

SELECT TOP 100 u, g, r, i, z 
FROM Galaxy with (nolock)
WHERE (objID%1000) = 1 
   AND (r between 18 and 21)

