SQL

SQL

Made by DeepSource

Unused Common Table Expression in query SQL-L045

Style
Minor

Defining a CTE(Common Table Expression) that is not used by the query is harmless, but it means the code is unnecessary and could be removed.

Bad practice

WITH cte1 AS (
    SELECT a
    FROM t
),
cte2 AS (
    SELECT b
    FROM u
)

SELECT *
FROM cte1

Recommended

WITH cte1 AS (
    SELECT a
    FROM t
)

SELECT *
FROM cte1