Sloan Digital Sky Survey
SkyServer DR15  
Not logged in Login Help
 

SQL Tutorial
 Back to Help
 1. Introduction
 2. A Simple Query
 Practice
 3. Common Searches
 4. More Samples
 Practice
 5. Multiple Tables
 Practice
 6. Aggregate Fcns.
 7. Group By
 8. Order By
 Practice
 9. Views
 10. Functions
 Practice
 11. Conclusion
SQL Tutorial

Writing Simple Queries

Now it's your turn to write some SQL queries! The query window below contains the sample query from the last page. Modify it to answer the questions in Practice 1 and Practice 2 below.

Practice 1. What objects has the SDSS seen in a smaller area of the sky near
ra = 140.5, dec = 20.5 (the same area you searched in the previous query)?

Modify the previous query so it will return ra and dec of objects where the ra is between 140.25 and 140.75 and the dec is between 20.25 and 20.75. About how many objects did the query return? Does this seem to make sense, given the smaller area you searched here?

Show Sample Solution

Practice 2. Which of the objects you found in Practice 1 are galaxies?

Open the Schema Browser  (new window). Click on views and select SpecObj. You will see a list of all the columns in the SpecObj table, along with short descriptions of what they mean and if applicable, what values the column may have.

For instance, if you scroll down to the "class" column, its description says that it may have one of the following values: 'STAR', 'GALAXY', or 'QSO'. Modify your query so that it returns the ra, dec, and best object ID for galaxies (and only galaxies) whose ra is between 140.25 and 140.75 and whose dec is between 20.25 and 20.75.

Show Sample Solution

Answers

Format HTML XML CSV

Enter your SQL query in the text box. The query is limited to 10 minutes and 100,000 rows.