1.11.2. Joins on tables in the Data LabΒΆ

For some queries, you will want to retrieve information from more than one table in a survey dataset, or retrieve information across survey datasets, e.g. to identify objects in DECaLS that have spectra in SDSS. To do this, you will need to join one table against one or more other tables in the Data Lab. See SQL Basics and Gotchas for examples and links that explain the various ways in which tables can be joined (Khan Academy has a particularly nice tutorial), and some warnings about sizes when performing joins on large tables.

To join tables, you need to identify the keys in the tables on which you will perform the table match. For tables in the Data Lab, these are typically one or more columns of object IDs. These Entity-Relationship Diagrams (ERDs) for DECaLS/SDSS and for SMASH identify the keys to use in joining tables:

DECaLS/SDSS ERD
SMASH Survey ERD