Obtaining objects and it's BPZ redshit, we need to JOIN two tables with a two column identifier. We restrict the search to a box in the sky and magnitude in 'r' lower than 20.:
SELECT Obj.alpha_j2000, Obj.delta_j2000, Obj.mag_auto, Obj.mag_err_auto, Obj.class_star, Obj.flags, Obj.mask_flags, Bpz.* FROM jplus.MagABDualObj obj, jplus.PhotoZBpz bpz WHERE obj.TILE_ID = bpz.TILE_ID AND obj.NUMBER = bpz.NUMBER AND obj.mag_auto[jplus::rSDSS] < 20.0 AND CONTAINS(POINT('', Obj.alpha_j2000, Obj.delta_j2000), BOX('', 125, 30, .49, .49)) = 1
Obtaining the catalogue in magnitudes of a tile image by its identifier (2035 in the example):
SELECT * FROM jplus.MagABSingleObj WHERE TILE_ID = 2035
Obtaining the catalogue in magnitudes of a known object by its identifier (number 12 and image 2035 in the example):
SELECT * FROM jplus.MagABSingleObj WHERE TILE_ID = 2035 AND number = 12
Obtaining the catalogue in f(nu) fluxes of a tile image by its name, filtering objects with problems in its detection:
SELECT i.zpt, m.* FROM jplus.FNuSingleObj m, jplus.TileImage i WHERE i.tile_id = m.tile_id AND i.name = '1000001-JPLUS-02623-v1_zSDSS_swp' AND (FLAGS = 0 OR FLAGS = 2048)
Obtaining the catalogue object in magnitudes in each filter of a reference tile image by its identifier, selecting only objects with gSDSS more than a magnitude brighter than rSDSS:
SELECT * FROM jplus.MagABDualObj WHERE TILE_ID = 2035 AND MAG_AUTO[jplus::gSDSS] - MAG_AUTO[jplus::rSDSS] > 1
Obtaining the number of objects per magnitude ordering by magnitude:
SELECT ROUND(MAG_AUTO[jplus::rSDSS], 0) AS MAG, COUNT(*) FROM jplus.MagABDualObj GROUP BY MAG ORDER BY MAG
Querying all columns and limiting the number of results, up to 50 rows, filtering images by right ascension:
SELECT TOP 50 * FROM jplus.TileImage WHERE ra > 116.0 AND ra < 116.5
Selecting image by filter using an enumeration to identify the filter:
SELECT * FROM jplus.TileImage WHERE filter_id = jplus::rSDSS
Joining tables and using geometric functions to do a cone search:
SELECT m.alpha_j2000, m.delta_j2000, m.flux_auto, m.class_star, i.name, i.tile_id FROM jplus.FNuDualObj m, jplus.TileImage i WHERE m.tile_id = i.tile_id AND CONTAINS(POINT('', m.alpha_j2000, m.delta_j2000), CIRCLE('', 7.8574, 5.67881, .005)) = 1
Search images that cover a point (144.7989, 30.6) in a specific band (R) with the ObsCore table:
SELECT dataproduct_type, s_ra, s_dec, access_url FROM ivoa.obscore WHERE contains(point('ICRS', 144.7989, 30.6), s_region) = 1 AND em_min < 0.000006231 AND em_max > 0.000006231