Rename table with spaces mysql

后端 未结 3 1841
心在旅途
心在旅途 2020-12-19 15:07

I have a table \'A B C\' (with spaces, don\'t ask me why) in MySQL database. I have to rename it to \'ABC\' This query doesn\'t work :(

rename table \'A B          


        
相关标签:
3条回答
  • 2020-12-19 15:14

    Escape the name with backticks.

    rename table `A B C` to ABC
    
    0 讨论(0)
  • 2020-12-19 15:16

    You probably just need to enclose the name w/spaces with tick marks (`) instead of single (') quotes. I don't know how to escape ticks so they show in the code preview but I think you will be able to figure it out.

    0 讨论(0)
  • 2020-12-19 15:39

    Use backticks:

    rename table `A B C` to ABC;
    
    0 讨论(0)
提交回复
热议问题