Difference Between Update and Alter Commands in SQL | Oracle

The ‘UPDATE’ and ‘ALTER’ are the SQL (structured query language) commands. These two commands are used for the modifying data or metadata in relations database management system (RDBMS).

These two commands has specific role in SQL and other specifications. Here, I am describing the comparison between update and alter commands.

Let’s compare,

Update command vs Alter command in SQL Oracle [Tabular Form]

#ContentUPDATE CommandALTER Command
01Basics of
Update & Alter commands
‘UPDATE’ command is used to the change or modify the value of column of existing table. ‘ALTER’ command is used to modify the structure of the existing table.
02SQL language type‘UPDATE’ is command of data manipulation language (DML).‘ALTER’ is command of data definition language (DDL).
03Syntax of Update and Alter commandsUPDATE table_name
SET column_name1= value1, column_name2= value2,…,column_nameN= valueN
WHERE condition;
ALTER TABLE table_name
ADD column_name datatype;
04Basic FunctionThe ‘UPDATE’ command only changes the value of columns. The developer can update specific records using ‘WHERE’ clause. With the help of the ‘ALTER’ command, you can add columns, rename columns, drop columns, add constraint to columns, and change the datatypes of columns.
05OperationThis command works at the data of the table. This command works at metadata of table or table structure.
06Commit roleThe ‘COMMIT’ command is required after the execution of of the ‘UPDATE’ statement to save the changes. All DDL (i.e. ALTER) command are auto ‘COMMIT’ enabled. So, no explicit ‘COMMIT’ command is needed.

These are the basics concepts of Update command vs Alter command in SQL. Hopefully, you have understood all the above points. So, don’t forget to learn this difference. Beacuses, it is mostly asked in interviews.

Read realted another interview question: What are the difference between DELETE, DROP and TRUNCATE commands in SQL?

If you have any points to enrich update vs alter commands, please comment below.

Thanks for Reading!

Read more related Informatica Power Center (IPC):

Test your knowledge and practice online quiz for FREE!

Practice Now »

 

Leave a Comment