You need to use backticks around the table name where the table name has blank space. Let us first create a table.
Here, we have used backtick −
mysql> create table `Demo Table138`
(
Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
Price int
);
Query OK, 0 rows affected (0.47 sec)
Insert records in the table using insert command −
mysql> insert into `Demo Table138`(Price) values(450);
Query OK, 1 row affected (0.18 sec)
mysql> insert into `Demo Table138`(Price) values(499);
Query OK, 1 row affected (0.16 sec)
mysql> insert into `Demo Table138`(Price) values(199);
Query OK, 1 row affected (0.17 sec)
mysql> insert into `Demo Table138`(Price) values(3090);
Query OK, 1 row affected (0.21 sec)
Display records from the table using select command −
Following is the query to select data from a table where the table name has blank spaces in it −
mysql> select *from `Demo Table138`;
This will produce the following output −
+----+-------+
| Id | Price |
+----+-------+
| 1 | 450 |
| 2 | 499 |
| 3 | 199 |
| 4 | 3090 |
+----+-------+
4 rows in set (0.00 sec)