QuestionQ47

VerifiedDisplaying Data from Multiple Tables

Review these two queries and their results:

SELECT deptno, dname FROM dept;

Question Image

SELECT emame, job, deptno FROM emp ORDER BY deptno;

Question Image

Now review this query:

Question Image

How many rows are displayed?

Explanation

CROSS JOIN produces a Cartesian product. The WHERE clause selects 3 employees whose job is MANAGER and 2 department rows whose department number is 10 or 20; without a condition relating the two tables, each manager is paired with each selected department, producing 6 rows.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!