Obtaining objects and it's Lephare redshift, 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, lephare.* FROM jnep.MagABDualObj obj, jnep.PhotoZLephare lephare WHERE obj.TILE_ID = lephare.TILE_ID AND obj.NUMBER = lephare.NUMBER AND obj.mag_auto[jnep::rSDSS] < 20.0 AND CONTAINS(POINT('', Obj.alpha_j2000, Obj.delta_j2000), BOX('', 260.6205, 65.8172, .49, .49)) = 1
Obtaining the catalogue in magnitudes of a tile image by its identifier (2520 in the example):
SELECT * FROM jnep.MagABSingleObj WHERE TILE_ID = 2520
Obtaining the catalogue in magnitudes of a known object by its identifier (number 10 and image 2520 in the example):
SELECT * FROM jnep.MagABSingleObj WHERE TILE_ID = 2520 AND number = 10
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 jnep.FNuSingleObj m, jnep.TileImage i WHERE i.tile_id = m.tile_id AND i.name = 'JNEP-v202106_J0460_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 jnep.MagABDualObj WHERE TILE_ID = 2520 AND MAG_AUTO[jnep::gSDSS] - MAG_AUTO[jnep::rSDSS] > 1
Obtaining the number of objects per magnitude ordering by magnitude:
SELECT ROUND(MAG_AUTO[jnep::rSDSS], 0) AS MAG, COUNT(*) FROM jnep.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 jnep.TileImage WHERE ra > 260.0 AND ra < 260.6
Selecting image by filter using an enumeration to identify the filter:
SELECT * FROM jnep.TileImage WHERE filter_id = jnep::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 jnep.FNuDualObj m, jnep.TileImage i WHERE m.tile_id = i.tile_id AND CONTAINS(POINT('', m.alpha_j2000, m.delta_j2000), CIRCLE('', 260.6205, 65.8172, .005)) = 1