1Z0-060 · Question #159
Examine the structure of the customers table: CUSTNO is the primary key in the table. You want to find out if any customers' details have been entered more than once using different CUSTNO, by…
The correct answer is A. Self-join B. Subquery. This question tests the ability to identify which SQL techniques can detect rows with duplicate non-key column values across different primary key values in the same table.
Question
Examine the structure of the customers table:
CUSTNO is the primary key in the table. You want to find out if any customers' details have been entered more than once using different CUSTNO, by listing all the duplicate names. Which two methods can you use to get the required result?
Exhibit
Options
- ASelf-join
- BSubquery
- CFull outer-join with self-join
- DLeft outer-join with self-join
- ERight outer-join with self-join
How the community answered
(32 responses)- A75% (24)
- C16% (5)
- D6% (2)
- E3% (1)
Why each option
This question tests the ability to identify which SQL techniques can detect rows with duplicate non-key column values across different primary key values in the same table.
A self-join joins the CUSTOMERS table to itself on matching name columns while filtering for rows where CUSTNO values differ, directly producing a result set of all name pairs entered under different customer numbers.
A subquery using GROUP BY on the name columns with HAVING COUNT(*) > 1 identifies which names appear more than once, and the outer query then retrieves all matching rows including their distinct CUSTNO values.
A full outer join returns all rows from both sides of the join including non-matching rows, which adds irrelevant data and does not improve duplicate detection beyond what a simple self-join provides.
A left outer join preserves all rows from the left table regardless of whether they match, introducing unnecessary rows that complicate rather than simplify finding duplicates.
A right outer join preserves all rows from the right table regardless of match status, which similarly adds unwanted complexity without offering any advantage over a standard self-join for this use case.
Concept tested: Self-join and subquery for duplicate data detection
Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html
Topics
Community Discussion
No community discussion yet for this question.
