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. |
Recommended Posts:
- Difference between Deferred update and Immediate update
- SQL | ALTER (RENAME)
- SQL | ALTER (ADD, DROP, MODIFY)
- Create, Alter and Drop schema in MS SQL Server
- Difference between grep and fgrep command
- SQL | UPDATE Statement
- Update clause in Cassandra
- PHP | MySQL UPDATE Query
- Performing Database Operations in Java | SQL CREATE, INSERT, UPDATE, DELETE and SELECT
- Expand on command in Cassandra
- Difference between USB 2.0 and USB 3.0
- Difference between MAN and WAN
- What is the difference between GUI and CUI?
- Difference Between Gi-Fi and Li-Fi
- Difference between GSM and LTE
- Difference between OOP and POP
- Difference between 4NF and 5NF
- Difference between Tor and VPN
- Difference between DVD-R and DVD-RW
- Difference between TCP and RTP
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.


