Wildcard Operators in SQL is not an operator but is a character. A wildcard character is used to substitute one or more characters in a string. Wildcard characters are used with the LIKE operator. The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
Please read the previous post
Introduction to Structured Query Language (SQL)
Object-Relational Database
SELECT Statement in SQL
Group By Clause in SQL
Having Clause in SQL
Now we will discuss first Like operator in SQL.
LIKE Operator:
It is a powerful query operator required to extract data from a table depending on the character position. This operator can be operated on two types of values.
Like operator provides two wildcard character i.e.
- _(underscore) to represent one, single character
- %( percentile) to represent zero, one, or multiple characters
Q. Write a query which will display those records whose name starts with S‘.
Select * from emp where ename like 's%';
Q. Write a query which will display those records whose 3rd char is‘I‘ and last char is ‗h‘.
Select * from emp where ename like ‗'__i%h';