How to Make Changes to the Database Structure in MySQL
Edited by Maluniu, Michal, omniomi, Harri and 3 others
Here is a summary of the query to make changes to MySQL database structure tables.
This article has been tagged as a stub. That means it's off to a good start, but still has plenty of room to grow before it reaches its full potential. Can you help it flourish? If you think the article offers complete and accurate instructions, feel free to remove this tag! |
EditSteps
EditTips
- Here is a list of the <change-command> you can use:
- Add new column: ADD <columname> <datatype> <optional-parameters>
- Change default value for a column: ALTER <columnname> SET DEFAULT <newvalue>
- Remove default value for a column: ALTER <columnname> DROP DEFAULT
- Change the definition of a column and rename the column: CHANGE <columnname> <newcolname> <datatype> <optional-parameters>
- Change the definition of a column: MODIFY <columnname> <datatype> <optional-parameters>
- Delete a column (and all data permanently): DROP <columnname>
- Rename a table: RENAME <newtablename>