Files @ 0818c337d503
Branch filter:

Location: DA/lsst_blog/sql/s15/q13.sql - annotation

Bart Scheers
Add blog post url
/*select count(*) from Object o1, Object o2 
 where qserv_areaspec_box(90.299197, -66.468216, 98.762526, -56.412851) 
   and scisql_angSep(o1.ra, o1.decl, o2.ra, o2.decl) < 0.015;

From the black-box UDFs we cannot tell exactly how this traslates
to plain SQL

Is it this:
select count(*) 
  from Object o1
      ,Object o2 
 WHERE o1.ra BETWEEN 90.299197 AND 98.762526
   AND o1.decl BETWEEN -66.468216 AND -56.412851
   AND o1.decl BETWEEN o2.decl - 0.015 and o2.decl + 0.015
   AND o1.ra BETWEEN o2.ra - alpha(o2.decl, 0.015) AND o2.ra + alpha(o2.decl, 0.015)
;
or the one below?
*/

select count(*) 
  from Object o1
      ,(select decl - 0.015 as decl_min
              ,decl + 0.015 as decl_max
              ,ra - alpha(decl, 0.015) as ra_min
              ,ra + alpha(decl, 0.015) as ra_max
         from Object
        where ra BETWEEN 90.299197 AND 98.762526
          and decl BETWEEN -66.468216 AND -56.412851
       ) o2
 WHERE o1.ra BETWEEN 90.299197 AND 98.762526
   AND o1.decl BETWEEN -66.468216 AND -56.412851
   AND o1.decl BETWEEN decl_min and decl_max
   AND o1.ra BETWEEN ra_min AND ra_max
;