Sloan Digital Sky Survey III
SkyServer DR10  
 

DR10 Help
 Start Here
 FAQ
 Glossary
 Cooking with Sloan
     - General
     - Solar System
     - Stars
     - Galaxies
     - QSOs/Cosmology
     - Teaching/Labs
 Tool User Guides
 Contact Help Desk
 
 Searching SDSS-III
 SQL Tutorial
 SQL in SkyServer
 About the Database
 Table Descriptions
 Sample SQL Queries
 Schema Browser
 Searching Advice
 Query Limits
 
 Details of the Data
 Algorithms
 Data Publications
 API
Check Flags

Back to General Tasks index

Search for flags with SQL (open in new window)


You can also search through flags as part of your searches using SQL. SQL searches will search for and return flags as long decimal numbers that have been converted from binary - but you translate between these numbers and the flag names with the functions dbo.fPhotoFlags and dbo.fPhotoFlagsN.

  1. Go to the SQL Search tool (opens in new window), under the Search menu. To get there from the astronomers' main page, look under Search Tools. To get there from the public main page, look for Search under SkyServer tools.

  2. To constrain your search based on flags, add one of the following to the WHERE block of your query:

    1. To find only objects for which a certain flag is present:

      WHERE (p.flags & dbo.fPhotoFlags('flag')) > 0

      Replace flag with the name of the flag you want to search.

      For example, this query will find IDs and positions of objects that have been flagged as having moved:

      SELECT objid, ra, dec
      FROM photoTag
      WHERE (flags & dbo.fPhotoFlags('MOVED')) > 0
    2. To find only objects for which a certain flag is absent:

      WHERE (p.flags & dbo.fPhotoFlags('flag')) = 0

      Replace flag with the name of the flag you want to search.

      For example, this query will screen out IDs and positions of objects that have been flagged as not being saturated:

      SELECT objid, ra, dec
      FROM photoTag
      WHERE (flags & dbo.fPhotoFlags('SATURATED')) = 0

 

The form below will let you practice searching for flags with SQL, using the example queries on this page. Press Query 1 or Query 2 to load the queries, and Submit to run the queries.

Format HTML XML CSV



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


Next: Get objects with clean photometry

 Go to the previous page Go to the next page

Back to Cooking with Sloan main page
Back to Help main page
Contact Help Desk