MySQL : Rename Table

Rename Table in MySql Database.

To RENAME an existing table in MySQL database, we can use the ALTER TABLE statement.
This command allows us to change the name of a table without losing any data or affecting table structure. For instance, if we have a table named ‘users’ and want to rename it to ‘admin’, we would execute the following SQL statement:

To rename an existing table in MySQL, we use the RENAME statement to change the name of the existing table.

Syntax :

RENAME TABLE old_table_name TO new_table_name;

For example, if we have a table named users and we want to change it to admin, we can do this in MySQL using the following statement:

Example :
RENAME TABLE users TO admin;

This command effectively change the table name in the database schema.
Remember to check for any dependencies, such as views or stored procedures, that might be affected by this change to ensure everything functions correctly after the renaming the table.

Leave a Comment