Create a table with a space in the name in mySQL

后端 未结 2 821
猫巷女王i
猫巷女王i 2020-12-11 05:35

I want to create a table in mySQL with the name of \"123 Product\", with numbers in the beginning and a space in between. I can do this using phpmyAdmin but I want to make t

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 06:02

    You can simply try this: enclose table name with backticks (`)

    $sql = "
    CREATE TABLE `123 Product` 
    (
    `product_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    `product_name` VARCHAR(255) NOT NULL
     ) 
    ENGINE = InnoDB;
    ";
    

提交回复
热议问题