How To Rename an Existing Table

Q

How To Rename an Existing Table? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements

✍: FYIcenter.com

A

If you want to rename an existing table, you can use the "ALTER TABLE ... RENAME TO" statement. The tutorial script below shows you a good example:

mysql> ALTER TABLE tip RENAME TO faq;
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT * FROM faq;
+----+-------------+-------------------------+--------+
| id | title       | description             | author |
+----+-------------+-------------------------+--------+
|  1 | Learn MySQL | Visit dev.fyicenter.com | NULL   |
+----+-------------+-------------------------+--------+
1 row in set (0.00 sec)

2007-05-11, 4235👍, 0💬