Why is NATURAL JOIN considered risky in production queries?
Correct answer
C. It joins on every same-named column, so a new column silently changes it
16 views
C. It joins on every same-named column, so a new column silently changes it
16 views
NATURAL JOIN equates all columns that share a name across the two tables, so adding a column such as created_at to either table silently changes the join condition and the row count. It also removes the duplicate columns from the output, which can hide the mistake. Explicit ON or USING clauses keep the intent visible, reviewable and diffable in version control.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is C? Ask here and get an explanation.