How to rename SQL tables

How to rename SQL tables

Introduction:

There are at least three different table classifications supported by the SQL specification. There are two quick ways to rename them.

Requirements:

An SQL development environment, such as a MySQL client and server connection.

Procedure:

There are two ways to rename a table, which differs depending on the type of table. You can alter a table with either:

alter table tableName rename to tableNewName;

or with as instead of to:

alter table tableName rename as tableNewName;

or:

rename table tableName to tableNewName;

or a variation on rename table:

rename table tableName to tableNewName, secondTableName to secondTableNewName;

Temporary tables cannot use rename table. You can of course remove a table with:

drop table tableName;

if needed.