

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- MySQL query to remove special characters from column values?
- MySQL query to retrieve only the column values with special characters?
- MySQL query to replace special characters from column value
- How to use special characters in column names with MySQL?
- MySQL regular expression to update a table with column values including string, numbers and special characters
- Set special characters on values if condition is true in MySQL?
- Fetch a specific record from a column with string values (string, numbers and special characters) in MySQL
- Special Characters in HTML
- 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?
- Adding characters in values for an existing int column in MySQL?
- How can we escape special characters in MySQL statement?
- MySQL query to select a specific string with special characters
- How to remove special characters from a database field in MySQL?
Advertisements