top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is difference between Update and Alter commands?

+2 votes
3,463 views
What is difference between Update and Alter commands?
posted Jul 27, 2015 by Suchithra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Update is a SQL command that is used to update existing records in a database, while alter is a SQL command that is used to modify, delete or add a column to an existing table in a database.

Update is a DML statement whereas alter is a DDL statement. Alter command modifies the database schema, while update statement only modifies records in a database without modifying its structure.

UPDATE:

Used to update existing records in a Database.

It is a DML Command, means commands that are used to manage data without altering the DB Schema are called DML statements.

Syntax:

UPDATE Table_name SET Col1name=value1, col2name = val2,WHERE ColXname = some value

ALTER:

Used to modify, delete or add a column to an existing table in a Database.

It is a DDL command, means commands that are used to define the structure of a DB (DB Schema) are called DDL statements.

ALTER TABLE Table_name ADD newColname dataTypeofNewCol or to delete a col
DROP Colname or change datatype of an existing col in table
ALTER Column Colname newDatatype

answer Jul 28, 2015 by Manikandan J
Thank you. Precise to the point
...