-- Find galaxies with more specific spectra.
-- Same as prior query, but also require weak Hbeta line (Halpha/Hbeta > 20.)

SELECT G.ObjID 			-- return qualifying galaxies
into mydb.sampletest FROM	Galaxy   as G, 		-- G is the galaxy
 	SpecObj    as S, 		-- S is the spectra of galaxy G
 	SpecLine   as L1, 		-- L1 is a line of S
	SpecLine   as L2,		-- L2 is a second line of S
	specLineNames as LN1,		-- the names of the lines (Halpha)
	specLineNames as LN2		-- the names of the lines (Hbeta)
WHERE G.ObjID = S.BestObjID 		-- connect the galaxy to the spectrum  
  and S.SpecObjID = L1.SpecObjID	-- L1 is a line of S.
  and S.SpecObjID = L2.SpecObjID	-- L2 is a line of S. 
  and L1.LineId = LN1. value	
  and LN1.name =  'Ha_6565'   		-- L1 is the H alpha line
  and L2.LineId = LN2.value		-- L2 is the H alpha line
  and LN2.name =  'Hb_4863'     	--  
  and L1.ew > 200			-- BIG Halpha
  and L2.ew > 10			-- significant Hbeta emission line 
  and L2.ew * 20 < L1.ew 		-- Hbeta is comparatively small
