If you want to find a character in the article
Example:
| The code is as follows: |
Copy code |
Select * from table where content like '% key %' |
However, the key itself has the '%' number, which must be an error in the SQL statement or cannot be found.
Later, Baidu found the ESCAPE definition ESCAPE character in SQL to solve this problem.
Example:
| The code is as follows: |
Copy code |
Select * from table where content like '%/%' escape '/' |
/Is an escape character, the second % is a common character, and the first and third % are wildcards.
| The code is as follows: |
Copy code |
| Select * from table where content like '%/% // % 'escape '/' |
/Is an escape character, the second % is a common character, the first and third % are wildcards, the second/is an escape character, and the third/is a common character.
Tips
Because % is a special character, % in the string after like needs to be escaped. This requires the use of escape to define the escape character. In this example, "" is defined as a conversion
Character shifting.