wiki:db/queries/004
Last modified 6 years ago Last modified on 01/31/2013 11:12:47 PM

Random sample of the data

Give me the colors of a random x% sample of objects from all fields which are 'survey quality' so that I could plot up color-color diagrams and play around with more sophisticated cuts.

SELECT fluxToAbMag(uFlux_PS), 
       fluxToAbMag(gFlux_PS), 
       fluxToAbMag(rFlux_PS), 
       fluxToAbMag(iFlux_PS), 
       fluxToAbMag(zFlux_PS), 
       fluxToAbMag(yFlux_PS)
FROM   Object 
WHERE  (objectId  % 100 )= :percentage

Query volume: moderate. Depending on x%, it can touch significant fraction of the Object table.

Possible variation: select random sample of the data + return not just colors, but also variability within that random sample (so how much of the sky is showing variability) (suggested by Lynne Jones)

This query originally came from SDSS (SX-13)