-- Galaxies meeting multiple simple criteria.
-- Find all galaxies with blue surface brightness between 23 and 25
-- mag per square arcseconds, and -10 < supergalactic latitude (sgb) < 10, and
-- declination less than zero. Currently, we have to live with ra/dec until we
-- get galactic coordinates. To calculate surface brightness per sq. arcsec,
-- we use (g + rho), where g is the blue magnitude, and rho= 5*log(r).  This
-- query now has three requirements, one involving simple math.
--
-- On DR2, returns 61090 rows in 330 sec.

SELECT objID 
into mydb.sampletest
FROM Galaxy 
WHERE ra between 178 and 180 
  and dec < 0
--  and (g+rho) between 23 and 25
  and g between (23-rho) and (25-rho)
-- g is the blue magnitude, and rho= 5*log(Petro radius)
