Which concept of the relation is shown by the following query?
SELECT EMPLOYEE.EMPID, EMPLOYEE.NAME, ORDER.ORDERID, ORDER.ORDERDATE
FROM EMPLOYEE, ORDER;
Which concept of the relation is shown by the following query?
SELECT EMPLOYEE.EMPID, EMPLOYEE.NAME, ORDER.ORDERID, ORDER.ORDERDATE
FROM EMPLOYEE, ORDER;
Solution
The query lists two tables in the FROM clause with no WHERE or JOIN condition. Every row of EMPLOYEE is therefore paired with every row of ORDER. This is a Cartesian product, giving rows for tables with and rows.
Options 1 and 2: an equi-join or natural join needs a matching condition on a common column, such as , and this query has none.
Option 3: an outer join needs the keywords LEFT, RIGHT or FULL OUTER JOIN with an ON condition, and neither appears here.
Memory trick: a comma-separated table list with no condition means Cartesian product.
Related questions:
2026: 26 May Shift 1
2025: 22 May Shift 1