Home > Database > Mysql Tutorial > body text

The difference between ALTER and UPDATE commands in SQL

WBOY
Release: 2023-09-03 09:45:02
forward
1518 people have browsed it

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;
Copy after login

Delete a column

ALTER TABLE table_name DROP COLUMN column_name;
Copy after login

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 ];
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template