CompTIA Tech+ (FC0-U71)Data and Database FundamentalsMedium

A database administrator needs to change the phone number for a specific customer whose CustomerID is 45 in the Customers table, without affecting any other rows. Which SQL statement is most appropriate?

  1. ASELECT Phone FROM Customers WHERE CustomerID = 45;
  2. BDELETE FROM Customers WHERE CustomerID = 45;
  3. CUPDATE Customers SET Phone = '555-9876' WHERE CustomerID = 45;
  4. DINSERT INTO Customers (Phone) VALUES ('555-9876');
Show answer & explanation

Correct answer: C. UPDATE Customers SET Phone = '555-9876' WHERE CustomerID = 45;

UPDATE modifies existing data in a table, and the SET clause specifies the new value while WHERE limits the change to the row matching CustomerID = 45. Without the WHERE clause, every row in the table would be updated.

Why the other options are wrong

  • A. SELECT only retrieves the phone number, it does not change it.
  • B. DELETE would remove the customer's entire record instead of updating a field.
  • D. INSERT would add a brand-new row rather than modifying an existing customer's data.

SQL UPDATE Statement

A SQL statement used to modify existing data in one or more rows of a table.

  • Basic syntax: UPDATE table SET column = value WHERE condition.
  • Omitting WHERE updates every row in the table.
  • Different from INSERT, which adds new rows instead of changing existing ones.

Memory trick: UPDATE is like erasing and rewriting one line in a ledger, not the whole book.

More Data and Database Fundamentals questions