Bird
0
0

Which clause would you use to skip inserting a row if a conflict occurs on a unique key?

easy📝 Conceptual Q2 of 15
PostgreSQL - Set Operations and Advanced Queries
Which clause would you use to skip inserting a row if a conflict occurs on a unique key?
AON CONFLICT DO UPDATE
BON CONFLICT DO NOTHING
CON CONFLICT DELETE
DON CONFLICT IGNORE
Step-by-Step Solution
Solution:
  1. Step 1: Identify the clause to skip insert on conflict

    The clause DO NOTHING tells PostgreSQL to skip the insert if a conflict happens.
  2. Step 2: Confirm the correct syntax

    ON CONFLICT DO NOTHING is the correct syntax to ignore the conflicting insert.
  3. Final Answer:

    ON CONFLICT DO NOTHING -> Option B
  4. Quick Check:

    Skip insert on conflict = DO NOTHING [OK]
Quick Trick: Use DO NOTHING to skip conflicting inserts [OK]
Common Mistakes:
  • Using DO UPDATE when you want to skip insert
  • Assuming DELETE works with ON CONFLICT
  • Using IGNORE which is invalid syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes