Tutorials
Help
 Introduction
 Schema Browser
 Intro to SQL
 How To
    - Search
    - Graph
 Web Browsers
Searching
 Back
 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

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 = 194.5, dec = 2.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 194.25 and 194.75 and the dec is between 2.25 and 2.75. About how many objects did the query return? Does this seem to make sense, given the smaller area you searched here?

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

Open the Schema Browser. Click on views and select SpecObj. You will see a list of all the columns in the SpecObj table. If you click on the Link to PhotoType symbol, you will see the various values that column may have. For instance, the "specClass" column may contain numbers that correspond to stars, galaxies, quasars, etc. Modify your query so that it returns the ra, dec, and best object ID for galaxies (and only galaxies) whose ra is between 194.25 and 194.75 and whose dec is between 2.25 and 2.75.

Answers


Format HTML XML CSV

Enter your SQL query in the text box. The query is limited to 90 seconds and 1,000 rows.