QuestionQ272

VerifiedManipulating Data

Examine the data in the NEW_EMPLOYEES table:

Question Image

Examine the data in the EMPLOYEES table:

Question Image

You want to:

  1. Update existing employee details in the EMPLOYEES table using data from the NEW_EMPLOYEES table.
  2. Add new employee details from the NEW_EMPLOYEES table into the EMPLOYEES table.

Which statement accomplishes this?

Explanation

An Oracle MERGE statement matches source and target rows through its ON condition. WHEN MATCHED THEN UPDATE updates rows already in the target, and WHEN NOT MATCHED THEN INSERT inserts source rows that have no target match. The valid matching and conditional-update/insert structure uses ON, MATCHED, and NOT MATCHED.

Learn more

Community Discussion

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