Wildcard Characters
Wildcard characters are the characters that can be used for searching, filtering, a and retrieving data that follow a specific structure. With the help of wildcard characters, we can handle complex queries to fetch results very easily. Here are some wildcard characters that we will use everywhere.
1. Wildcard Character Percent Sign (%)
It is used to match the zero or more number of occurrences in the fields. Lets understand with the examples. Suppose we have created GeekforGeeks Table and we have to find out how many people are work in IT Department so we can simply find out the result with the help of LIKE operator.
Syntax:
SELECT emp_name,emp_dept FROM GeekforGeeks WHERE emp_dept LIKE "IT%"
Explanation: We simply fetch the employees name along with the department name for all employees works in IT departments. In like we have more than one character that’s why we use % with LIKE operator. Result shown below.
2. Wildcard Character Underscore Sign (_ )
It is used to match one character of the field. We use _ wildcard when we want the character at the exact position. Lets understand with the example in GeekforGeeks table. Suppose we have to find out those employees whose name contain ‘a’ at the second position.
Syntax:
SELECT emp_name,emp_dept FROM GeekforGeeks WHERE emp_name LIKE "_a%"
Explanation: We simply fetch all the employees which contain character ‘a’ at the second position. We can clearly understand that here we have match only one character. Result shown below.
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.