thespacedoctor
1/9/2018 - 3:51 PM

[SQL Queries to Bulk Extract SDSS Catalogues] #sdss #sherlock #catalogue #star #galaxy #qso

[SQL Queries to Bulk Extract SDSS Catalogues] #sdss #sherlock #catalogue #star #galaxy #qso

        SELECT
            g.objID,
            g.obj,
            g.mode,
            g.nChild,
            g.type,
            g.clean,
            g.probPSF,
            g.insideMask,
            g.flags,
            g.psfMag_u,
            g.psfMag_g,
            g.psfMag_r,
            g.psfMag_i,
            g.psfMag_z,
            g.psfMagErr_u,
            g.psfMagErr_g,
            g.psfMagErr_r,
            g.psfMagErr_i,
            g.psfMagErr_z,
            g.petroMag_u,
            g.petroMag_g,
            g.petroMag_r,
            g.petroMag_i,
            g.petroMag_z,
            g.petroMagErr_u,
            g.petroMagErr_g,
            g.petroMagErr_r,
            g.petroMagErr_i,
            g.petroMagErr_z,
            g.probPSF_u,
            g.probPSF_g,
            g.probPSF_r,
            g.probPSF_i,
            g.probPSF_z,
            g.ra,
            g.dec,
            g.raErr,
            g.decErr,
            g.extinction_u,
            g.extinction_g,
            g.extinction_r,
            g.extinction_i,
            g.extinction_z,
            g.mjd,
            g.loadVersion,
            g.parentID,
            g.specObjID,
            g.u,
            g.g,
            g.r,
            g.i,
            g.z,
            g.err_u,
            g.err_g,
            g.err_r,
            g.err_i,
            g.err_z,
            g.nObserve,
            g.nDetect,
            g.nEdge,
            g.score,
            g.TAI_u,
            g.TAI_g,
            g.TAI_r,
            g.TAI_i,
            g.TAI_z
        FROM Star g
    
        SELECT
            g.objID,
            g.obj,
            g.mode,
            g.nChild,
            g.type,
            g.clean,
            g.probPSF,
            g.insideMask,
            g.flags,
            g.psfMag_u,
            g.psfMag_g,
            g.psfMag_r,
            g.psfMag_i,
            g.psfMag_z,
            g.psfMagErr_u,
            g.psfMagErr_g,
            g.psfMagErr_r,
            g.psfMagErr_i,
            g.psfMagErr_z,
            g.petroMag_u,
            g.petroMag_g,
            g.petroMag_r,
            g.petroMag_i,
            g.petroMag_z,
            g.petroMagErr_u,
            g.petroMagErr_g,
            g.petroMagErr_r,
            g.petroMagErr_i,
            g.petroMagErr_z,
            g.probPSF_u,
            g.probPSF_g,
            g.probPSF_r,
            g.probPSF_i,
            g.probPSF_z,
            g.ra,
            g.dec,
            g.raErr,
            g.decErr,
            g.extinction_u,
            g.extinction_g,
            g.extinction_r,
            g.extinction_i,
            g.extinction_z,
            g.mjd,
            g.loadVersion,
            g.parentID,
            g.specObjID,
            g.u,
            g.g,
            g.r,
            g.i,
            g.z,
            g.err_u,
            g.err_g,
            g.err_r,
            g.err_i,
            g.err_z,
            g.nObserve,
            g.nDetect,
            g.nEdge,
            g.score,
            g.TAI_u,
            g.TAI_g,
            g.TAI_r,
            g.TAI_i,
            g.TAI_z,
            s.z specz,
            s.zErr speczErr
        FROM PhotoObjAll g, SpecObjAll s
        WHERE g.specobjid=s.specobjid
        and s.class='QSO'
    
        SELECT
            g.objID,
            g.obj,
            g.mode,
            g.nChild,
            g.type,
            g.clean,
            g.probPSF,
            g.insideMask,
            g.flags,
            g.psfMag_u,
            g.psfMag_g,
            g.psfMag_r,
            g.psfMag_i,
            g.psfMag_z,
            g.psfMagErr_u,
            g.psfMagErr_g,
            g.psfMagErr_r,
            g.psfMagErr_i,
            g.psfMagErr_z,
            g.petroMag_u,
            g.petroMag_g,
            g.petroMag_r,
            g.petroMag_i,
            g.petroMag_z,
            g.petroMagErr_u,
            g.petroMagErr_g,
            g.petroMagErr_r,
            g.petroMagErr_i,
            g.petroMagErr_z,
            g.probPSF_u,
            g.probPSF_g,
            g.probPSF_r,
            g.probPSF_i,
            g.probPSF_z,
            g.ra,
            g.dec,
            g.raErr,
            g.decErr,
            g.extinction_u,
            g.extinction_g,
            g.extinction_r,
            g.extinction_i,
            g.extinction_z,
            g.mjd,
            g.loadVersion,
            g.parentID,
            g.specObjID,
            g.u,
            g.g,
            g.r,
            g.i,
            g.z,
            g.err_u,
            g.err_g,
            g.err_r,
            g.err_i,
            g.err_z,
            g.nObserve,
            g.nDetect,
            g.nEdge,
            g.score,
            g.TAI_u,
            g.TAI_g,
            g.TAI_r,
            g.TAI_i,
            g.TAI_z,
            s.z specz,
            s.zErr speczErr
        FROM PhotoObjAll g, SpecObjAll s
        WHERE g.specobjid=s.specobjid
        and s.class='GALAXY'
    
        SELECT
            g.objID,
            g.obj,
            g.mode,
            g.nChild,
            g.type,
            g.clean,
            g.probPSF,
            g.insideMask,
            g.flags,
            g.psfMag_u,
            g.psfMag_g,
            g.psfMag_r,
            g.psfMag_i,
            g.psfMag_z,
            g.psfMagErr_u,
            g.psfMagErr_g,
            g.psfMagErr_r,
            g.psfMagErr_i,
            g.psfMagErr_z,
            g.petroMag_u,
            g.petroMag_g,
            g.petroMag_r,
            g.petroMag_i,
            g.petroMag_z,
            g.petroMagErr_u,
            g.petroMagErr_g,
            g.petroMagErr_r,
            g.petroMagErr_i,
            g.petroMagErr_z,
            g.probPSF_u,
            g.probPSF_g,
            g.probPSF_r,
            g.probPSF_i,
            g.probPSF_z,
            g.ra,
            g.dec,
            g.raErr,
            g.decErr,
            g.extinction_u,
            g.extinction_g,
            g.extinction_r,
            g.extinction_i,
            g.extinction_z,
            g.mjd,
            g.loadVersion,
            g.parentID,
            g.specObjID,
            g.u,
            g.g,
            g.r,
            g.i,
            g.z,
            g.err_u,
            g.err_g,
            g.err_r,
            g.err_i,
            g.err_z,
            g.nObserve,
            g.nDetect,
            g.nEdge,
            g.score,
            g.TAI_u,
            g.TAI_g,
            g.TAI_r,
            g.TAI_i,
            g.TAI_z,
            p.z z_,
            p.zErr,
            p.distMod,
            p.absMagU,
            p.absMagG,
            p.absMagR,
            p.absMagI,
            p.absMagZ
        FROM Galaxy g, Photoz p
        WHERE g.Objid = p.objID
    

These are the queries we use to extract out the relevant galaxy, star and QSO information we need from SDSS for our local QUB contextual classifier (Sherlock). These queries need to be re-ran and the data re-imported into our local database for each SDSS data-release.