The SQL command used to change the values stored in the name attribute of…

2021

The SQL command used to change the values stored in the name attribute of existing rows in the PUBLISHER relation is

Answer: A. UPDATEConceptSQL separates changes to stored row data from changes to a table definition. Data-manipulation statements act on rows, while data-definition statements…

  1. A.

    UPDATE

  2. B.

    ALTER

  3. C.

    MODIFY

  4. D.

    DELETE

Show answer & explanation

Correct answer: A

Concept

SQL separates changes to stored row data from changes to a table definition. Data-manipulation statements act on rows, while data-definition statements act on schema objects such as columns and constraints.

To replace a value in an existing row, use UPDATE with a SET clause; a WHERE clause limits which rows are changed.

Application

  1. Identify the target as an existing relation, PUBLISHER, whose rows already contain publisher names.

  2. The required operation changes the stored value of the name attribute; it does not change the attribute definition.

  3. The matching statement form is UPDATE PUBLISHER SET name = <new_name> WHERE <condition>;

  4. Therefore, the applicable command is UPDATE.

Cross-check and contrast

  • UPDATE assigns replacement column values to selected existing rows.

  • ALTER changes the schema of a table, such as its columns or constraints.

  • MODIFY is used in some dialects within schema-alteration syntax to redefine a column.

  • DELETE removes selected rows instead of replacing a value within them.

Result: UPDATE is the command for changing publisher-name values in existing rows.

Explore the full course: Up Police Computer Operator

Loading lesson…