Create a table with a space in the name

10.8k Views Asked by At

I want to create a table in MySQL with the name "123 Product", with numbers at the beginning and a space in between. I can do this using phpMyAdmin but I want to make this table using PHP. But, unfortunately, I am unable to do this.

1

There are 1 best solutions below

0
AudioBubble On BEST ANSWER

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

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