SQL Command for Modifying Existing Records
The correct answer is 'B. update'.
The 'update' command in SQL is specifically used to modify existing records within a table. Here's how it works:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Explanation:
- UPDATE table_name: Specifies the table you want to modify.
- SET column1 = value1, column2 = value2, ...: Sets new values for specific columns in the record(s) you want to change.
- WHERE condition: Optionally filters which records are updated. This ensures you only modify the intended records.
Example:
UPDATE Customers
SET FirstName = 'John', LastName = 'Doe'
WHERE CustomerID = 1;
This example updates the 'FirstName' and 'LastName' columns in the 'Customers' table for the record where 'CustomerID' is 1.
Why other options are incorrect:
- 'select' retrieves data from a table, but doesn't modify it.
- 'insert' adds new records to a table.
- 'None of them' is incorrect as 'update' is the correct command.
原文地址: https://www.cveoy.top/t/topic/nxcM 著作权归作者所有。请勿转载和采集!