Difference between ALTER and UPDATE Command in SQL

1. ALTER Command :
Alter SQL command is used to modify, delete or add a column to an existing table in a database. Alter is a Data Definition Language (DDL) statement.
Syntax :

UPDATE        tableName
SET           column1Name=value1, column2Name=value2, ...
WHERE         columnXName=someValue 

2. UPDATE Command :
Update command is used to update existing records in a database. Update is a Data Manipulation Language (DML) statement.
Syntax :

ALTER TABLE   tableName
ADD           newColumnName dataTypeOfNewColumn
ALTER TABLE   tableName
DROP COLUMN   columnName
ALTER TABLE   tableName
ALTER COLUMN  columnName newDataType 

Difference Between ALTER and UPDATE Command in SQL :

SR.NO ALTER Command UPDATE Command
1 ALTER command is Data Definition Language (DDL). UPDATE Command is a Data Manipulation Language (DML).
2 Alter command will perform the action on structure level and not on the data level. Update command will perform on the data level.
3 ALTER Command is used to add, delete, modify the attributes of the relations (tables) in the database. UPDATE Command is used to update existing records in a database.
4 ALTER Command by default initializes values of all the tuple as NULL. UPDATE Command sets specified values in the command to the tuples.
5 This command make changes with table structure. This command makes changes with data inside the table.
6 Example : Table structure, Table Name, SP, functions etc. Example : Change data in the table in rows or in column etc.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.