Loved by learners at thousands of companies
Now that you've learned the basics of SQL in our Introduction to SQL course, it's time to supercharge your queries using joins and relational set theory. In this course, you'll learn all about the power of joining tables while exploring interesting features of countries and their cities throughout the world. You will master inner and outer joins, as well as self joins, semi joins, anti joins and cross joins—fundamental tools in any PostgreSQL wizard's toolbox. Never fear set theory again after learning all about unions, intersections, and except clauses through easy-to-understand diagrams and examples. Lastly, you'll be introduced to the challenging topic of subqueries. You will be able to visually grasp these ideas by using Venn diagrams and other linking illustrations.
Introduction to joinsFree
In this chapter, you'll be introduced to the concept of joining tables, and will explore the different ways you can enrich your queries using inner joins and self joins. You'll also see how to use the case statement to split up a field into different categories.
Outer joins and cross joins
In this chapter, you'll come to grips with different kinds of outer joins. You'll learn how to gain further insights into your data through left joins, right joins, and full joins. In addition to outer joins, you'll also work with cross joins.
Set theory clauses
In this chapter, you'll learn more about set theory using Venn diagrams and get an introduction to union, union all, intersect, and except clauses. You'll finish by investigating semi joins and anti joins, which provide a nice introduction to subqueries.State of the UNION50 xpUnion100 xpUnion (2)100 xpUnion all100 xpINTERSECTional data science50 xpIntersect100 xpIntersect (2)100 xpReview union and intersect50 xpEXCEPTional50 xpExcept100 xpExcept (2)100 xpSemi-joins and Anti-joins50 xpSemi-join100 xpRelating semi-join to a tweaked inner join50 xpDiagnosing problems using anti-join100 xpSet theory challenge100 xp
In this closing chapter, you'll learn how to use nested queries and you'll use what you’ve learned in this course to solve three challenge problems.Subqueries inside WHERE and SELECT clauses50 xpSubquery inside where100 xpSubquery inside where (2)100 xpSubquery inside select100 xpSubquery inside FROM clause50 xpSubquery inside from100 xpAdvanced subquery100 xpSubquery challenge100 xpSubquery review50 xpCourse review50 xpFinal challenge100 xpFinal challenge (2)100 xpFinal challenge (3)100 xp
PrerequisitesIntroduction to SQL
Dr. Chester Ismay
Educator, Data Scientist, and R/Python Consultant
Chester enjoys helping others get into data science, figuring out how to best practice and improve on their skills, and working as a part-time consultant on R and Python programming projects. He is co-author of "Statistical Inference via Data Science: A ModernDive into R and the Tidyverse" available at moderndive.com and for purchase from CRC Press. He likes leading education and data science teams with the goal of improving best practices based on data from the learning sciences.
What do other learners have to say?
I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.
Devon Edwards Joseph
Lloyds Banking Group
DataCamp is the top resource I recommend for learning data science.
Harvard Business School
DataCamp is by far my favorite website to learn from.
Decision Science Analytics, USAA