SQL DatabaseLesson 51Free preview
SQL Alter Table
This lesson is part of SQL · All levels
Summary
ALTER TABLE is used to alter the structure of an existing table, for example by adding, changing, or deleting columns. It can also add constraints or change data types. Because of the impact on the data already stored, changes in data types need to be considered carefully.
Key points
- Add columns: ALTER TABLE t Add columns of type;
- Change the type: ALTER TABLE t Modify the type_new column;
- Delete the column: ALTER TABLE t DROP column column;
- Add the constraint: ALTER TABLE T add the constraint...
- Changing the column name in MySQL: ALTER TABLE t CHANGE the column_old_new column type;
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.