SQLite with the ESCAPE Clause
Suppose we use Like operator with – or % wildcard and the field also contain _ or % as a character then it is difficult to match wildcard with the same character in the fields. So we overcome this problems by using ESCAPE Clause. ESCAPE Clause helps us to determine the pattern even it contain wildcards as a literals. ESCAPE simply avoid the wildcard characters specified in the condition and gave us the correct output.
Syntax:
SELECT result FROM table WHERE expression LIKE expression ESCAPE expression
We will understand with the help of example.
SELECT emp_name,emp_dept FROM GeekforGeeks WHERE emp_name LIKE '%\_%' ESCAPE '\'
In this above query we will fetch all employees who have ‘_’ in their name . here ‘_’ is considered as a simple character with the help of ESCAPE Clause which will avoid/escape the _ as a wildcard and return the result.
Explanation: We have two employees with the _ in their name with the help of ESCAPE clause.
SQLite LIKE Operator
SQLite is a serverless architecture that we use to develop embedded software for devices like televisions, cameras, and so on. It is written in C programming Language. It allows the programs to run without any configuration. In this article, we will learn everything about the LIKE operator. After reading this article you will get decent knowledge about the LIKE operator.