QuizzesINSERT, UPDATE & DELETE — Concept Check
intermediate
sql

INSERT, UPDATE & DELETE — Concept Check

Questions on INSERT, UPDATE & DELETE. INSERT adds rows, UPDATE modifies existing rows, and DELETE removes rows; each supports set-based operations and must be used carefully to avoid unintended mass mutations.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on INSERT, UPDATE & DELETE — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer accidentally ran an UPDATE statement without a WHERE clause on a production database. What is the likely outcome?

    • AOnly the first row is updated.
    • BNo rows are updated due to an error.
    • CAll rows in the table are updated.
    • DOnly rows with NULL values are updated.
  2. 2.You need to insert multiple rows into a table efficiently. Which method should you use?

    • AUse a separate transaction for each row.
    • BUse multi-row INSERT syntax for batch inserts.
    • CLoop through each row and use single-row INSERTs.
    • DInsert rows one by one using a stored procedure.
  3. 3.A DELETE statement was executed without a WHERE clause. What happens to the table?

    • ARows with NULL values are deleted.
    • BThe table structure is deleted.
    • COnly the first row is deleted.
    • DAll rows are deleted, but slower than TRUNCATE.
  4. 4.Which of the following is a safe practice before executing a DELETE statement?

    • AUse DELETE without a WHERE clause for efficiency.
    • BAssume only a few rows will be affected.
    • CRun a SELECT with the same WHERE clause to verify affected rows.
    • DDirectly execute DELETE to save time.
  5. 5.What is the purpose of the UPSERT operation in PostgreSQL?

    • AInsert a row or update it if a conflict occurs.
    • BDelete duplicate rows before inserting.
    • COnly insert new rows, ignoring duplicates.
    • DInsert rows without any conflict checks.
  6. 6.A developer uses TRUNCATE on a table. What is a key characteristic of this operation?

    • AIt removes only rows with NULL values.
    • BIt removes all rows and is non-transactional in MySQL.
    • CIt is slower than DELETE for large tables.
    • DIt logs each row deletion individually.
  7. 7.In PostgreSQL, what does the RETURNING clause do in an UPDATE statement?

    • AEnsures no rows are updated if an error occurs.
    • BReturns the updated rows in the same statement.
    • CDeletes the updated rows after returning them.
    • DPrevents any changes if the WHERE clause is incorrect.
  8. 8.What is a common anti-pattern when inserting data into a database?

    • AUsing UPSERT for conflict resolution.
    • BUsing single-row inserts inside a loop.
    • CUsing COPY for bulk data loading.
    • DUsing multi-row batch inserts.