Difference Between ALTER and UPDATE Command in SQL

SQLDatabaseData Structure

In this post, we will understand the difference between the ALTER command and the UPDATE command in SQL.

ALTER Command

  • This command is a Data Definition Language (DDL).

  • It performs operation at the structural level, not the data level.

  • This command is used to add, delete, and modify the attributes of the tables in a database.

  • This command, by default, initializes the values of all values in the tuple to NULL.

  • It changes the structure of the table.

Syntax: Add a column −

ALTER TABLE table_name ADD column_name datatype;

Drop a Column

ALTER TABLE table_name DROP COLUMN column_name;

UPDATE Command

  • This command is a Data Manipulation Language (DML).

  • It performs operations on the data level.

  • It updates the existing records in a database.

  • It sets the specified values in a tuple using the UPDATE command.

  • It changes the data inside the table.

Syntax:

UPDATE table_name
SET column1 = value1, column2 = value2....columnN=valueN
[ WHERE CONDITION ];
raja
Published on 15-Apr-2021 11:15:52
Advertisements