• iconteach@devfunda.com

CROSS JOIN

CROSS JOIN

07-09-2025 22:33:53 Time to read : 12 Minutes

The CROSS JOIN keyword combines every row from the left table with every row from the right table, producing all possible row combinations. If the input tables have x and y columns, the result will contain x + y columns. Since CROSS JOINs can create very large result sets, they should be used carefully and only when needed.

cross_join_postgresql

Show every possible employee-department combination:

SELECT e.emp_name, d.dept_name
FROM employees e
CROSS JOIN departments d;

Want to learn in class