right-join
What it does
Section titled “What it does”Reports a RIGHT join.
Why it matters
Section titled “Why it matters”Most queries read from left to right and join the next table onto what came before. A right join makes the reader turn that around, and the same result is a LEFT JOIN with the tables in the other order.
To fix, swap the tables and use LEFT JOIN.
Example
Section titled “Example”...select 1 union distinct select 2;...select a from t right join u on t.a = u.a;select a from t left join u on t.a = u.a;...Configuration
Section titled “Configuration”sql: lint: rules: right-join: warn # off (default), warn, errorEnabled by the presets: sql/sqlfluff.
Suppress one line with sudsy-disable-next-line right-join in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| sqlfluff | CV08 |
full |