Sloan Digital Sky Survey
SkyServer DR14  
Not logged in Login Help

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

Practice Using Functions

Write queries to answer the astronomy questions in Practice 10 and 11. Use the Schema Browser when you need it.

Practice 10. In the field 5112-6-119, what percentage of all objects detected by the SDSS are too close to the edge of their fields to be trusted?

Hint: Use two searches, one with a flag and one without. Search run=5112, camcol=6, field=119.

Show Sample Solution

Practice 11. Choose a galaxy cluster from SkyServer's Famous Places tool. Write a query to select galaxies in the cluster, and only galaxies in the cluster.

Hint: After you pick a cluster, use the Navigation Tool to examine the cluster. Guess which galaxies belong to the cluster - you should be able to tell just by looking. Click on 5-10 cluster galaxies and save them in your online notebook. Open the notebook, and look for features that the cluster galaxies have in common. Guess the center position and radius of the galaxies. Then, write a query that uses what you have learned to search for cluster galaxies.

Show Sample Solution


An Afterthought: Procedures and Constants

In addition to tables, views, and functions, the Schema Browser contains entries for procedures and constants. Procedures, like functions, are mini-programs that the database can execute. Unlike functions, they do not output a single value; rather, they manipulate the inputs passed in to them. Procedures are called with the syntax


Nearly all of the procedures in SkyServer are used by the web server or tools - you will hardly ever use them in your queries. If you ever need them, the Schema Browser will tell you what they do and how to use them.

Constants are, well, constant. They can be displayed and searched just like tables can. See the Schema Browser for a complete description of SkyServer's constants.

You're done! Click Next for the conclusion.


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