Summary

In this chapter, we have covered how to use HAVING clauses, subqueries, and joins in Python. We have also seen:

  • How to restrict results using HAVING
  • How HAVING differs from WHERE
  • When it is best to use the following—WHERE or HAVING
  • How to narrow data even further with subqueries
  • Using UNION to concatenate two results sets before they are returned
  • The various ways to join tables, including the difference between a LEFT JOIN and a RIGHT JOIN as well as the differences between INNER joins, OUTER joins, NATURAL joins, and CROSS joins

In the next chapter, we will look at several more of MySQL's powerful functions and how to use them best in Python.

Get MySQL for Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.