- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to select data from a table where the table name has blank spaces in MYSQL?
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)
- How to select from table where conditions are set for id and name in MySQL?
- How do I select data from one table only where column values from that table match the column values of another table in MySQL?
- How to select all the data from a table using MySQL in Python?
- How to select data in MySQL where a field has a minimum value?
- Update only a single value from a MySQL table where select from same table ordered in descending order?
- Select from table where value does not exist with MySQL?
- How to select a column name with spaces in MySQL?
- Select the table name as a column in a UNION select query with MySQL?
- Where is the MySQL table data stored in Windows?
- MySQL select query to select rows from a table that are not in another table?
- How to select from MySQL table A that does not exist in table B?
- Insert values in a table by MySQL SELECT from another table in MySQL?
- How can we write MySQL stored procedure to select all the data from a table?
- Select some data from a database table and insert into another table in the same database with MySQL
- Update data in one table from data in another table in MySQL?