在MySQL中修改表名的SQL語句

來源:互聯網
上載者:User

在使用MySQL時,經常遇到表名不符合規範或標準,但是表裡已經有大量的資料了,如何保留資料,只更改表名呢?

可以通過建一個相同的表結構的表,把原來的資料匯入到新表中,但是這樣視乎很麻煩。

能否簡單使用一個SQL語句就搞定呢?當然可以,MySQL 5.0下我們使用這樣的SQL語句就可以了。

ALTER  TABLE table_name RENAME TO new_table_name

例如 ALTER  TABLE admin_user RENAME TO a_user

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.