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 minijpas.MagABDualObj obj, minijpas.PhotoZLephare lephare WHERE obj.TILE_ID = lephare.TILE_ID AND obj.NUMBER = lephare.NUMBER AND obj.mag_auto[minijpas::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 (250 in the example):
SELECT * FROM minijpas.MagABSingleObj WHERE TILE_ID = 250
Obtaining the catalogue in magnitudes of a known object by its identifier (number 12 and image 250 in the example):
SELECT * FROM minijpas.MagABSingleObj WHERE TILE_ID = 250 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 minijpas.FNuSingleObj m, minijpas.TileImage i WHERE i.tile_id = m.tile_id AND i.name = 'AEGIS002-v1_rSDSS_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 minijpas.MagABDualObj WHERE TILE_ID = 2035 AND MAG_AUTO[minijpas::gSDSS] - MAG_AUTO[minijpas::rSDSS] > 1
Obtaining the number of objects per magnitude ordering by magnitude:
SELECT ROUND(MAG_AUTO[minijpas::rSDSS], 0) AS MAG, COUNT(*) FROM minijpas.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 minijpas.TileImage WHERE ra > 116.0 AND ra < 116.5
Selecting image by filter using an enumeration to identify the filter:
SELECT * FROM minijpas.TileImage WHERE filter_id = minijpas::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 minijpas.FNuDualObj m, minijpas.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