syntax error while using join in sql, same error is shown if i use natural join

100 Views Asked by At

syntax error while using join in sql, same error is shown if i use natural join

select * from
DEPT join EMP;

select * from
DEPT natural join EMP;
1

There are 1 best solutions below

1
On

Don't use natural join. Ever. Be explicit about the join conditions. It does not use properly declared foreign key relationships. Instead it simply uses columns that have the same name.

Who knows what the join conditions are? But I would guess something like:

select *
from dept join 
     emp
     on dept.department_id = emp.department_id;