RENAME TABLE
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Statements for MariaDB Xpand
Topics on this page:
Overview
Renames one or more tables or views, but not the associated privileges.
USAGE
Common Syntax:
RENAME TABLE
<tbl_name> TO <new_tbl_name>
[, <tbl_name2> TO <new_tbl_name2>] ...
EXAMPLES
RENAME TABLE
To rename a table or view:
RENAME TABLE
customers TO 2022_customers,
customers_view TO 2022_customers_view;
Move a Table to Another Database
To move a table from one database to another:
RENAME TABLE
db1.customers TO db2.customers,
db1.invoices TO db2.invoices;