Computer >> Computer tutorials >  >> Programming >> MySQL

How can we escape special characters in MySQL statement?


Sometimes we need to include special characters in a character string and at that time they must be escaped or protected. We need to pursue some basic rules for escaping special characters which are given below −

The escape character (\) can be escaped as (\\)

Example

mysql> Select 'A\\B';
+-----+
| A\B |
+-----+
| A\B |
+-----+
1 row in set (0.00 sec)