
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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)
- Related Articles
- 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?
- 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 data in MySQL where a field has a minimum value?
- How to select from MySQL table A that does not exist in table B?
- How can we write MySQL stored procedure to select all the data from a table?
- How to select a column name with spaces in MySQL?
- MySQL select query to select rows from a table that are not in another table?
- Insert values in a table by MySQL SELECT from another table in MySQL?
- Select some data from a database table and insert into another table in the same database with MySQL
- How to use an OUT parameter / read data with SELECT from table in a MySQL procedure?
- Where is the MySQL table data stored in Windows?
- Select the table name as a column in a UNION select query with MySQL?

Advertisements