Check out these sample queries used by your friends in the Cornell EGG.
Understand for yourself what they do.
*************
Select a set of inclined disk galaxies by H-alpha redshift
SELECT
p.ra, p.dec, s.z, p.expAB_r, p.fiberMag_r, p.petroMag_r,
p.petroR90_r, p.lnLExp_r, p.lnLDeV_r, l.sigma, l.sigmaErr,
l.ew, l.ewErr, l.chisq, l.nu, s.zWarning, p.isoPhi_u,
p.isoPhi_g, p.isoPhi_r, p.isoPhi_i, p.isoPhi_z
FROM PhotoObj p, SpecObj s, SpecLine l
WHERE
p.SpecObjID = s.SpecObjID AND
p.SpecObjID = l.specobjID AND
s.specClass=2 AND
l.sigma >= 2.1897 AND l.sigma <= 15.3280 AND
p.lnLExp_r > (13.81+p.lnLDeV_r) AND
l.lineID = dbo.fSpecLineNames('Ha_6565') AND
(p.ra >= 345 OR p.ra <= 45 ) AND
p.dec >= 5 AND p.dec <=35 AND
s.z <= 0.003
order by p.lnLExp_r desc
**********
Select by velocity dispersion:
SELECT
p.ra, p.dec, s.z, p.expAB_r, p.petroMag_r,
p.petroR90_r, p.lnLExp_r, p.lnLDeV_r, l.sigma, l.sigmaErr,
l.ew, l.ewErr, l.chisq, l.nu, s.zWarning, p.isoPhi_r, p.isoPhi_i
FROM PhotoObj p, SpecObj s, SpecLine l
WHERE
p.SpecObjID = s.SpecObjID AND
p.SpecObjID = l.specobjID AND
s.eClass < 0 AND
p.fracDev_r > 0.8 AND
l.lineID = dbo.fSpecLineNames('H_3970') AND
l.sigma*300000.0/l.wave > 350 AND
(p.ra >= 170 AND p.ra <= 210 ) AND
p.dec >= 5 AND p.dec <=15 AND
s.z <= 0.03
order by p.ra
Notice that sigma is expressed in weird units. To convert
to km/s you multiply by c and divide by the rest wavelength.
See the expression above.
************
Note that the SDSS folks use "weird" wavelength units.
Go to the Schema Browser;
Search for "wavelength";
Click on Columns, table SpecLineAll, Line rest wavelength
Scoll down to "lineID" and click there on "i";