Inner Joins

An inner join occurs when you connect two tables through a condition that must be satisfied by a pair of records, one from each table. You can request data from both of these tables at the same time. For example, connecting a common column that satisfies a condition is an inner join.

Natural joins are inner joins that the SQL Statement Builder creates for you. When you add a second table to a statement, the SQL Statement Builder prompts you to approve the creation of any available natural joins. Then a line between each set of naturally connected columns appears on the canvas at the same time as the second table.

In our example, when you add the departmental table to a statement that already includes the personnel table, the SQL Statement Builder prompts you to approve the creation of a natural join between the Employee_ID columns in each table.

To create an inner join between two columns that do not have the same column name, drag a line between the pins of the column names of the two tables. You can only create inner joins between columns of matching data types. Matching data types have the same pin color. For more information on the data types represented by each pin color, see the Colors in the SQL Statement Builder section.

In our example, the SQL Statement Builder allows you to drag a line between the Employee_Name column in the personnel table and the Department_Member column in the departmental table.

When you execute a statement containing an inner join, the results include only the rows from each table that have matching values in the joined columns.

In our example, executing the statement with the joined tables returns records of each engineering employee, containing the name and any information that is associated with that employee in either table. For example, one record could contain Jane Smith's personnel information, department name, and current project.

See Also

To create a natural inner join

Outer Joins

Performing Table Joins