
- 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 see spaces in data when selecting with MySQL command line client?
Use quote() function for this. The syntax is as follows −
select yourColumnName,quote(yourColumnName) from yourTableName;
To understand the concept, let us create a table. The query to create a table is as follows −
mysql> create table seeSpacesDemo -> ( -> spaceValue varchar(10) -> ); Query OK, 0 rows affected (0.42 sec)
Insert some records in the table using insert command. The query is as follows −
mysql> insert into seeSpacesDemo values(""); Query OK, 1 row affected (0.70 sec) mysql> insert into seeSpacesDemo values(" "); Query OK, 1 row affected (0.45 sec) mysql> insert into seeSpacesDemo values(" "); Query OK, 1 row affected (0.21 sec) mysql> insert into seeSpacesDemo values(" "); Query OK, 1 row affected (0.16 sec)
Display all records from the table using select statement. The query is as follows −
mysql> select *from seeSpacesDemo;
The following is the output −
+------------+ | spaceValue | +------------+ | | | | | | | | +------------+ 4 rows in set (0.00 sec)
Here is the query to see spaces in data when selecting with MySQL command line client −
mysql> select spaceValue,quote(spaceValue) from seeSpacesDemo;
The following is the output −
+------------+-------------------+ | spaceValue | quote(spaceValue) | +------------+-------------------+ | | '' | | | ' ' | | | ' ' | | | ' ' | +------------+-------------------+ 4 rows in set (0.00 sec)
- Related Articles
- The MySQL Command-Line Client
- MySQL command line client for Windows?
- MySQL query to discover current default database collation (via command line client)?
- How can I see how long statements take to execute on the MySQL command line?
- Best Command Line HTTP Client for Linux
- How to find the MySQL data directory from command line in Windows?
- How to display records vertically in MySQL command line?
- How to list databases vertically in MySQL command line?
- How to open MySQL command line on Windows10?
- How to upgrade MySQL server from command line?
- Rainbow Stream – An Advanced Command-line Twitter Client for Linux
- How can we transfer information between MySQL and data files through command line?
- How to create a database on command line in MySQL?
- How to repair MySQL tables from the command line?
- How to adjust display settings of MySQL command line?

Advertisements