Home  >  Article  >  Database  >  The difference between ALTER and UPDATE commands in SQL

The difference between ALTER and UPDATE commands in SQL

WBOY
WBOYforward
2023-09-03 09:45:021452browse

SQL 中 ALTER 和 UPDATE 命令的区别

In this article, we will understand the difference between ALTER command and UPDATE

command in SQL.

ALTER command

  • This command is data definition language (DDL).

  • It performs operations on the structure level, not the data level.

  • This command is used to add, delete and modify table attributes in the database.

  • This command initializes the values ​​of all values ​​in the tuple to NULL by default.

  • It changes the structure of the table.

Syntax: Add column−

ALTER TABLE table_name ADD column_name datatype;

Delete a column

ALTER TABLE table_name DROP COLUMN column_name;

UPDATE command

  • This command is A data manipulation language (DML).

  • It performs data level operations.

  • It updates existing records in the database.

  • It is using tuples of UPDATE commands.

  • It changes the data within the table.

Grammar:

UPDATE table_name
SET column1 = value1, column2 = value2....columnN=valueN
[ WHERE CONDITION ];

The above is the detailed content of The difference between ALTER and UPDATE commands in SQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete