Writing a Query

Now that you know what to look for to distinguish an HII region from a separate galaxy, you are ready to find some candidates. You could search for them using the Navigation Tool, but since the SkyServer contains spectra of over 350,000 galaxies, you’d be searching for a long time. It’s much easier to use SQL to write a query – a short computer program that requests only the data you need.

To find candidate HII regions, you are going to write a query to retrieve information on objects that Photo thinks are galaxies. You will want to search for galaxies for which the SDSS has measured spectra. You will also want to think about narrowing your search using the criteria from Question 1.

SkyServer uses Structured Query Language (SQL) for querying the database. SQL queries consist of three parts:

Select – The select block is what data you want retrieved for each object that meets your search criteria. You will probably want to retrieve at least the plate number, fiber number, object ID, magnitudes (u, g, r, i, z), ra, and dec. You may wish to see information from other tables as well.

From – The table(s) you want to search. You can get most of the data you need from the table SpecPhoto, which contains spectral and photometric data together. However, you may also want to use a join to search the SpecObj and PhotoObj tables separately. You may also want to see information in other tables.

Where – Places conditions on the data. This part of the query is where you narrow down your choices from the millions of spectra on SkyServer to the ones you are really interested in.

You want to be sure that you are looking at galaxies, not stars or quasars, so include the line:

specPhoto.class = ‘GALAXY’

To learn how to use SQL, see SkyServer’s Searching for Data how-to tutorial. You can find other SQL tutorials here and here.

To write a query on a database, you need to know how that database is structured. You can find the structure of SkyServer by studying the Schema Browser. Spend a few minutes getting a feel for where data are stored in the SDSS database, then start thinking about how to use SQL to search for HII regions. Use the form below to search. Remember that queries are limited to 90 seconds and 1,000 objects.
[sqlsearchwp-casjobs num=”0″]
When you have a list of candidate HII regions from your query, click Next. Your list will probably contain a few hundred possible regions. If you get 1,000, try refining your search characteristics in the where block.

pdf
flash

Click on an image to the right to get text as a Flash or PDF document