Practice 5. How can you look up image data, plates and spectra
of moderately bright nearby galaxies?
Write a query to find 100
galaxies for which we have spectra that have g magnitude between 17 and 17.4 and
redshift less than 0.05.
For each galaxy, retrieve the object ID, the five magnitudes (u,g,r,i,z), the redshift,
the plate/MJD number, and the fiber number.
Show Sample Solution
A query that accomplishes this task is:
SELECT top 100
gal.objID, gal.u, gal.g,
gal.r, gal.i, gal.z, s.z,
x.plate, x.mjd, s.fiberID
FROM galaxy gal
JOIN specObj s on s.bestObjID = gal.objID
JOIN plateX x on x.plateID = s.plateID
WHERE
s.class='galaxy'
AND gal.g BETWEEN 17 and 17.4
AND s.z < 0.05
Hide Sample Solution
|