Altering Tables Guide
Learn how to modify existing table structures using the ALTER TABLE statement, including adding columns, changing types, and managing indexes.
Before You Begin: Backup Your Tables
DESCRIBE clients;+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| cust_id | int(11) | | PRI | 0 | |
| name | varchar(25) | YES | | NULL | |
| address | varchar(25) | YES | | NULL | |
| city | varchar(25) | YES | | NULL | |
| state | char(2) | YES | | NULL | |
| zip | varchar(10) | YES | | NULL | |
| client_type | varchar(4) | YES | | NULL | |
+-------------+-------------+------+-----+---------+-------+mariadb-dump --user='your_username' --password='your_password' --add-locks db1 clients > clients.sqlAdding Columns
Changing Column Definitions
Dropping Columns
Managing Default Values
Managing Indexes
Renaming and Shifting Tables
Key Considerations
Last updated
Was this helpful?

