nerdexam
Oracle

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.

Upgrading to Oracle Database 12c

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

1Z0-060 question #159 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)
  • A
    75% (24)
  • C
    16% (5)
  • D
    6% (2)
  • E
    3% (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.

ASelf-joinCorrect

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.

BSubqueryCorrect

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.

CFull outer-join with self-join

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.

DLeft outer-join with self-join

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.

ERight outer-join with self-join

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

#self-join#subquery#duplicate detection#query techniques

Community Discussion

No community discussion yet for this question.

Full 1Z0-060 Practice