9. SELECT: WHERE clause

Behind the WHERE is a logical expression; these are similar to other languages as well, with operators AND, OR, and NOT.

SELECT source_id, ra, dec
  FROM gaiadr1.tgas_source
  phot_g_mean_flux > 13
  AND parallax < 0.2



Select the absolute magnitude, position and the source id for the 20 stars with the largest observed apparent magnitude in the g band from the table tgas_source (in case you don’t remember: The absolute magnitude is M= 5 + 5log π+ m with the parallax in arcsec π and the apparent magnitude m (check the units!). This will fail. Try to fix it.

Markus Demleitner

Copyright Notice