{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " SELECT columnnames\n", " FROM tablename\n", " WHERE conditions\n", "\n", "To make sure all of the abundances are valid, required that each abundance be larger than -10 (bad values are flagged as -999). \n", "
\n",
"While I haven't left you to fill in the query, please take a good look at it to make sure you see the possibilities."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"88346\n"
]
}
],
"source": [
"from astroquery.sdss import SDSS\n",
"sql=\" SELECT FE_H, MG_FE, O_FE, SI_FE, AL_FE, MN_FE, NI_FE, apogeeDistMass.age, apogeeStar.ra, apogeeStar.dec \\\n",
" FROM aspcapStar \\\n",
" JOIN apogeeStar on apogeeStar.apstar_id = aspcapStar.apstar_id \\\n",
" JOIN apogeeDistMass on apogeeDistMass.apstar_id = apogeeStar.apstar_id \\\n",
" WHERE aspcapStar.LOGG>1 AND aspcapStar.LOGG<2 AND FE_H>-10 AND MG_FE>-10 AND O_FE>-10 AND SI_FE>-10 \\\n",
" AND AL_FE>-10 AND MN_FE>-10 AND NI_FE>-10 \\\n",
" \"\n",
"dr17=SDSS.query_sql(sql, data_release=17) \n",
"print(len(dr17))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "Some errors were detected !\n Line #4 (got 6 columns instead of 1)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m