Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-1741

SQL tables should be joined with the "JOIN" keyword

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Refactor this SQL to join tables with help of the JOIN keyword.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Legacy Key:
      UseAnsiJoinsCheck
    • Targeted languages:
      RPG, T-SQL
    • Covered Languages:
      Cobol, PL/SQL
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      30min

      Description

      Since ANSI SQL-92, explicit joins using the JOIN keyword have been possible, and are preferred. Therefore table joins should be done with help of the one of the following clauses: JOIN, INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN. The old way to join tables is deprecated and should not be used anymore.

      Noncompliant Code Example

      SELECT *
      FROM PARTS, PRODUCTS
      WHERE PARTS.PROD = PRODUCTS.PROD
      

      Compliant Solution

      SELECT *
      FROM PARTS
      INNER JOIN PRODUCTS ON PARTS.PROD = PRODUCTS.PROD
      

        Attachments

          Issue Links

          1.
          PL/SQL RSPEC-4399 Language-Specification Active Unassigned

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              freddy.mallet Freddy Mallet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: