SQL provides you with many tools for mixing and cleaning data. In this chapter, you first learned how to combine two or more tables. You started with the
JOIN keyword, which fuses data from tables based on their common columns. There are several types of
JOIN. Depending on whether you want to retain the data in a certain table or not, you can choose
LEFT OUTER JOIN,
RIGHT OUTER JOIN,
FULL OUTER JOIN, or
CROSS JOIN. You then learned how to use subqueries and CTEs to preserve and reuse the results of queries. You can also use
UNION ALL to merge the results of two queries with the same structure into one result set.
After learning how to combine data from different datasets, you learned how to perform certain transformations on the data. You first started with the
WHEN function, which is a generic way to convert one expression into another based on custom-defined conditions. You then learned how to use the
NULLIF() functions to convert...