
- 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
Append special characters to column values in MySQL
Let us first create a −
mysql> create table DemoTable1626 -> ( -> Name varchar(20) -> ); Query OK, 0 rows affected (0.37 sec)
Insert some records in the table using insert −
mysql> insert into DemoTable1626 values('Chris'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1626 values('Bob'); Query OK, 1 row affected (0.34 sec) mysql> insert into DemoTable1626 values('Robert'); Query OK, 1 row affected (0.13 sec)
Display all records from the table using select −
mysql> select * from DemoTable1626;
This will produce the following output −
+--------+ | Name | +--------+ | Chris | | Bob | | Robert | +--------+ 3 rows in set (0.00 sec)
Following is the query to append special characters −
mysql> select rpad(Name,if(length(Name) >= 5,10,7),'*') from DemoTable1626;
This will produce the following output −
+-------------------------------------------+ | rpad(Name,if(length(Name) >= 5,10,7),'*') | +-------------------------------------------+ | Chris***** | | Bob**** | | Robert**** | +-------------------------------------------+ 3 rows in set (0.00 sec)
- Related Articles
- MySQL query to remove special characters from column values?
- MySQL query to retrieve only the column values with special characters?
- How to use special characters in column names with MySQL?
- MySQL query to replace special characters from column value
- MySQL regular expression to update a table with column values including string, numbers and special characters
- Fetch a specific record from a column with string values (string, numbers and special characters) in MySQL
- Set special characters on values if condition is true in MySQL?
- Adding characters in values for an existing int column in MySQL?
- How to split string values that contain special characters in R?
- UPDATE column to append data into it in MySQL?
- How to append 000 in a MySQL column value?
- Which MySQL function can be used to append values of a column with single quotes?
- How to remove special characters from a database field in MySQL?
- How can we escape special characters in MySQL statement?
- MySQL query to select a specific string with special characters

Advertisements