[{ALLOW edit EISMainUsers}]
[{ALLOW view Anonymous}]
!!! Searching the EIS Data Archive using SQL

The following is an example of how to search the EIS Data Archive using SQL search. This is a very powerful tool: we deliberately included all header keywords in the archive database so that you can search on pretty much anything, provided you format your search correctly.

!! Search requirements:\\

sit and stare data\\
exposure time < 20 secs\\
target = active region.\\

!! One can search for the above like this:\\

{{select * from eis_level0 where FMIR_SS="0" and TARGET="active region" and (date_obs between "2007-03-15" and "2007-03-20") and slit_id=1 order by date_obs}}

%%(color:#ff6600;)Haven't figure out how to choose "exposure time", any help?%%

-[Jian|JianSun], 8-Mar-2008

I think that in that way it works, but I didn't find any for the dates that you said:\\

{{select * from eis_level0 where FMIR_SS='0' and TARGET='active region' and (date_obs between '2007-03-15' and '2007-04-20') and slit_id=1 and (obt_end-obt_time)/512/nexp  <20 order by date_obs}}

Note: For some reason you cannot just copy the previous line, you have to rewrite the ' or " symbols, if not it gives a syntax error.

-[David Pérez-Suárez|DavidPS] 11-Mar-2008

I once had something similar to this copy-and-paste problem. Looking at it now, I think that it may be due to how the Wiki displays opening and closing quote marks. In the raw source, they are [straight quote marks|http://en.wikipedia.org/wiki/Quotation_mark_glyphs], as you would use in IDL. But when they are processed and displayed by the Wiki, they appear to change to the kind of curved quote marks that (for example) MS Word uses, i.e., "sixes and nines". Try Just substituting normal quote marks for those that appear. For example, when I do that, I get 34 results with the above search.

-[Dave|DavidRWilliams], 17-Mar-2008

You can use [AstroGrid|http://www.astrogrid.org/] to search for available data (and if you use it with python you could do even more complicated searches between different databases!).  In order to do the previous query, after choose the "Hinode EIS Level 0 and Level 2" service from the solar examples, you should write this query:

{{Select * From eis_level0 as aa Where aa.slit_id=1 And  ( ( (aa.obt_end-aa.obt_time  ) /aa.nexp  ) /512.0  ) <20 And aa.DATE_OBS>'2007-03-15' And aa.DATE_OBS<='2007-04-20' And aa.TARGET='active region' And aa.FMIR_SS='0'}}

-[David Pérez-Suárez|DavidPS], 7-Apr-2008