Home

NATURAL JOIN queries should not be used

Rule description

  • NATURAL JOIN queries should not be used

 

Non-compliant Code Example

SELECT
    od.*, odi.*
FROM
    orders od
NATURAL JOIN order_items odi; --Non compliant code (NATURAL JOIN query is used)

Compliant Code Example

SELECT
    od.*, odi.*
FROM
    orders od
INNER JOIN order_items odi ON --Compliant code (NATURAL JOIN query is not used)
    odi.order_id = od.order_id
ORDER BY
    od.order_date DESC;
Visual Expert 2020
 VEPLSQLRULE79