MySQL DatabaseLesson 51Free preview
MySQL Alter Table
This lesson is part of MySQL · All levels
Summary
ALTER TABLE is used to alter the structure of an existing table, such as adding, changing, or removing columns. This command can also be used to add constraints, change data types, and change column names. Because of the impact on the data table, major changes should be tested first in the staging environment.
Key points
- Add a new column to the table
- Modify column to change the data type or column definition without changing the name
- CHANGE COLUMN Changes the column name and definition
- DROP COLUMN deletes the column and its data
- You can also add/remove constraints and indexes through ALTER TABLE
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.