bg_image
header

Explicit join

An explicit join is a clear and direct way to define a join in an SQL query, where the type of join (such as INNER JOIN, LEFT JOIN, RIGHT JOIN, or FULL OUTER JOIN) is explicitly stated.

Example of an explicit join:

SELECT *
FROM customers
INNER JOIN orders
ON customers.customer_id = orders.customer_id;

This makes it clear:

  • Which tables are being joined (customers, orders)

  • What kind of join is used (INNER JOIN)

  • What the join condition is (ON customers.customer_id = orders.customer_id)


In contrast: Implicit join

An implicit join is the older style, using a comma in the FROM clause, and putting the join condition in the WHERE clause:

SELECT *
FROM customers, orders
WHERE customers.customer_id = orders.customer_id;

This works the same, but it's less clear and not ideal for complex queries.


Benefits of explicit joins:

  • More readable and structured, especially with multiple tables

  • Clear separation of join conditions (ON) and filter conditions (WHERE)

  • Recommended in modern SQL development


Implicit join

An implicit join is a way of joining tables in SQL without using the JOIN keyword explicitly. Instead, the join is expressed using the WHERE clause.

Example of an implicit join:

SELECT *
FROM customers, orders
WHERE customers.customer_id = orders.customer_id;

In this example, the tables customers and orders are joined using a condition in the WHERE clause.


In contrast, an explicit join looks like this:

SELECT *
FROM customers
JOIN orders ON customers.customer_id = orders.customer_id;

Differences:

Aspect Implicit Join Explicit Join
Syntax Tables separated by commas, joined via WHERE Uses JOIN and ON
Readability Less readable in complex queries More structured and readable
Error-proneness Higher (e.g., accidental cross joins) Lower, as join conditions are clearer
ANSI-92 compliance Not compliant Fully compliant

When is an implicit join used?

It was common in older SQL code, but explicit joins are recommended today, as they are clearer, easier to maintain, and less error-prone, especially in complex queries involving multiple tables.