How the Query Designer represents joins (ADP)

Microsoft Office Access 2003

In the Diagram pane the Query Designer displays a join line between the data columns involved in the join. The Query Designer displays one join line for each join condition. For example, the following illustration shows a join line between two tables that are joined:

Join line in Diagram pane

If tables are joined using more than one join condition, the Query Designer displays multiple join lines, as in the following example:

Join lines in Diagram pane

If the joined data columns are not displayed (for example, the rectangle representing the table, view, function, or subquery is minimized or the join involves an expression), the Query Designer places the join line at the title bar of the rectangle representing the table, view, function, or subquery.

The shape of the icon in the middle of the join line indicates how the tables, views, or functions are joined. If the join clause uses an operator other than equal (=), the operator appears in the join line icon. The following table lists the icons that appear in the join line.

Join line icon Description
Equal inner join icon Inner join (created using an equal sign).
Greater than inner join icon Inner join based on the "greater than" operator.
Left outer join icon Outer join in which all rows from the table represented on the left will be included, even if they do not have matches in the related table.
Right outer join icon Outer join in which all rows from the table represented on the right will be included, even if they do not have matches in the related table.
Full outer join icon Full outer join in which all rows from both tables will be included, even if they do not have matches in the related table.

The symbols on the ends of the join line indicate the type of join. The following table lists the types of joins and the icons displayed on the ends of the join line.

Icon on ends of join line Type of join
One-to-one join icon One-to-one join.
One-to-many join icon One-to-many join.
Undetermined join icon Query Designer cannot determine the join type. This situation occurs most often when you have created a join manually.

ShowSQL Pane

A join can be expressed in a number of ways in an SQL statement. The exact syntax depends on the database you are using and on how you have defined the join.

Syntax options for joining tables include:

  • JOIN qualifier for the FROM clause. The keywords INNER and OUTER specify the join type. This syntax is standard for ANSI 92 SQL.

    For example, if you join the publishers and pub_info tables based on the pub_id column in each table, the resulting SQL statement might look like this:

    SELECT *
    FROM publishers INNER JOIN pub_info ON
       publishers.pub_id = pub_info.pub_id
    						

    If you create an outer join, the words LEFT OUTER or RIGHT OUTER appear in place of the word INNER.

  • WHERE clause compares columns in both tables. A WHERE clause appears if the database does not support the JOIN syntax (or if you entered it yourself). If the join is created in the WHERE clause, both table names appear in the FROM clause.

    For example, the following statement joins the publishers and pub_info tables.

    SELECT *
    FROM publishers, pub_info
    WHERE publishers.pub_id = pub_info.pub_id
    						

    Note   Microsoft SQL Server databases support *= and =* syntax.