Chapter 3

Joins

A join is a database operation whereby two tables are combined in a considered way. In this chapter we will focus on join operations. In the last couple of chapters we showed you how to retrieve data from one table. In real-world databases data is usually spread over multiple tables, and so when it is necessary to retrieve data from more than one table, you use joins.

We start the chapter with a discussion of Cartesian products, a most basic way of retrieving data from two tables, and then we introduce joins. We also discuss aliases, COUNT, and rownum, since these concepts are often used in conjunction with multiple tables. Later in the chapter we take a more in-depth look at joins and we cover outer joins.

The Cartesian Product ...

Get Practical Guide to using SQL in Oracle now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.