[Solved] Difference between Alter and Update SQL

I am busy studying MySQL and I understand that update is used to update a record or row in a table. So what does alter do that is so different? Seems like they are the same.

Thanks, any help will be appreciated.

Solution #1:

ALTER is a DDL (Data Definition Language) statement. Whereas UPDATE is a DML (Data Manipulation Language) statement. ALTER is used to update the structure of the table (add/remove field/index etc). Whereas UPDATE is used to update data.

Respondent: Joyce Babu

Solution #2:

The ALTER changes the table in the database, you can add or remove columns, etc. But it does not change data (except in the dropped or added columns of course).

While the UPDATE changes the rows in the table, and leaves the table unchanged.

Respondent: Matzi

Solution #3:

ALTER is used to change things like table structures or stored procs, otherwise known as DDL statements.

ALTER table MyTable 
ADD MyNewColumn VARCHAR(100)

OR

ALTER PROC dbo.MyStoredProc
Respondent: Chris Gessler

Solution #4:

Alter command is a data definition language
Update command is a data manipulation language
Alter example- table structure, table name, sp, functions
Update example-change database in a row or column etc
Alter command make changes in table structure.
Update command make changes with inside the table
Alter command is used to add, delete modify the attributes of the table in the database
Update command is used to update existing record in a database

Respondent: Nikhil joshi

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.