Chapter 16. Cross Joins, Self Joins, and CrossTab Queries

This chapter finishes the discussion of techniques used to join two tables. You will not use these techniques very often, but knowing them will add depth to your understanding of all joins. They will also enable you to get results that would be almost impossible to obtain otherwise.

A cross join is used to define an inner join. It is also important in detecting errors in your code. Cross joins of small tables are acceptable and useful at times, but cross joins of large tables should be avoided.

A self join involves joining a table with itself. This is necessary when you need information from several rows of the same table at the same time.

Get SQL Fundamentals, Third Edition 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.