Site icon TestingDocs.com

MySQL ALTER TABLE Statement

Overview

In this tutorial, we will learn about MySQL ALTER TABLE Statement. The ALTER TABLE allows us to change an existing table in many ways. For example, We can use this statement to add or remove a column,
change column definitions, add or remove PRIMARY KEY, FOREIGN KEY
constraints, etc.

Syntax

The general syntax of the ALTER TABLE statement is as follows:

mysql> ALTER TABLE <table_name>
              <alter option> [{, <alter option>}…]

The can be many alter options like:
ADD COLUMN, ADD CONSTRAINT, ADD INDEX
DROP COLUMN, DROP INDEX , etc.

The common uses of the ALTER TABLE statement are:

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Exit mobile version