Search By SQL

Statements
                   

Samples

  • Looking for objects that in the circle with center at (331.7 degree, -1.4degress) and radius=0.2 degree.
    select c.obsid,c.obsdate, c.ra, c.dec, c.z, c.rv, c.lmjd 
    from catalogue c 
    where spos(c.ra,c.dec) @ scircle '<(331.7d, -1.4d),0.2d>' 
    limit 50
    	
  • Given certain condition, query the plan list and the information of center stars
    	
    select obsdate,planid,ra,dec,mjm 
    from plan 
    where obsdate
    	
  • Query the redshift of galaxies during given time
    select obsdate,planid,spid,fiberid,class,subclass,z 
    from catalogue 
    where obsdate between '20121201' and '20121230' and class ilike 'GALAXY' 
    limit 10
    	
  • Query stellar atmosphere parameters under certain condition such as date
    	
    select obsdate,planid,spid,fiberid,rv,logg,feh,teff 
    from stellar 
    where obsdate between '20121201' and '20121230' 
    limit 10
    
  • Query the parameters of F type stars cross-matching between two tables (left connection)
    select a.obsdate,a.planid,a.spid,a.fiberid,a.rv,logg,feh,teff 
    from catalogue as a 
    	left join stellar as b on a.obsid=b.obsid 
    where a.class ilike 'STAR' and a.subclass ilike 'F%' 
    limit 10
    	
  • Query the parameters of G type stars cross-matching between two tables (fully connected)
    select a.obsdate,a.planid,a.spid,a.fiberid,a.rv,logg,feh,teff 
    from catalogue as a 
    	join stellar as b on a.obsid=b.obsid 
    where a.class ilike 'STAR' and a.subclass ilike 'G%' 
    limit 10
    	
  • Query the radial velocity and other information of M type stars with H alpha magnetic activity
    select obsdate,planid,spid,fiberid,rv 
    from mstellar 
    where atcha=1 
    limit 10
    	

Notice

Be wared that: the charaters comparing in postgres is case-sensitive, which means class='star' and class='STAR' is not the same. If you want case-insensitive, you could use class ilike 'star'.

Available Datatable

About pg_Sphere library