MySQL: Rename Table

Profile picture for user arilio666

If we wanna change our table name or when the name is irrelevant to the data present inside a table and want to change it to its relevant name RENAME statement is the one to use for MySQL as it changes the current name of the table to a new one based on the user's request.

Syntax

RENAME TABLE old_table_name TO new_table_name;

Example

We will try to rename one of the tables named crypto_price_list to crypto_price.

RENAME table crypto_price_list TO crypto_price;

Now we can see that the name of the specified table has been changed to the demanded name using RENAME.

Tags