More Practice Queries
Write queries to answer the astronomy questions in Practice 3 and 4.
Use the Schema
Browser when you need it.
Practice 3. What are the reddest galaxies in the
area of sky near ra = 141?
Write a query to search for galaxies between ra = 140.9
and ra = 141.1 brighter than g = 18.0
for which u - g > 2.2. Retrieve the Object ID, ra,
dec, and the five final magnitudes.
Show Sample Solution
A query that accomplishes this task is:
select
objID, ra, dec, u, g, r, i, z
from
galaxy
where
ra BETWEEN 140.9 and 141.1
AND g < 18.0
AND u - g > 2.2
Hide Sample Solution
|
Practice 4. What are the highest-redshift
quasars in the SDSS database?
Write a query to search for quasars for which we have
obtained spectra (search the specObj table) with
redshifts greater than 4.5 and good measurements (zWarning = 0).
Retrieve each quasar's Photo ID, ra, dec, and redshift.
Show Sample Solution
A query that accomplishes this task is:
select
bestObjID, ra, dec, z
from
specObj
where
class='qso'
AND z > 4.5
AND zWarning = 0
Hide Sample Solution
|
|