Right now, will learn Wildcard administrators in SQL (Structured Query Language). Figure out how to utilize trump card administrator in SQL Query?
Trump card administrators are utilized related to like administrator to upgrade the pursuit in a table.
Trump card characters (% or _) can be utilized anyplace (left, right, in the middle of) in a word.
We may utilize various trump card characters in a solitary word rely upon our prerequisites.
- % (Percentage or percent sign)
- _ (Underscore)
1) % (Percentage or percent sign):
This special case character speaks to zero, one or more character (for example this is accessible for coordinating a string for any number of characters (0, 1, 2, … etc)).
Syntax:
SELECT column_name(s) from table_name like '%ppp%';
Here, “ppp” is any mix of a word or string.
Database table:
Eid | Ename | Salary |
---|---|---|
101 | preeti | 20000 |
102 | apoorv | 40000 |
103 | antima | 50000 |
104 | rahul | 10000 |
105 | pankaj | 5000 |
Example 1: Write an inquiry to discover all workers whose name begins with ‘p’:
SELECT ename from employee where ename like 'p%';
Output:
ename
preeti
pankaj
Example 2: Write a question to discover all representatives ids whose name closes with ‘I’:
SELECT eid from employee where ename like '%i';
Output:
Eid
101
2) _ (Underscore)
This special case character speaks to just one character (for example this is accessible for coordinating a string for a solitary character just (for example not contrast and at least zero than one character)).
Syntax:
SELECT column_name(s) from table_name like '_uuu_';
Here, “uuu” is any mix of a word or string.
Example 1: Write an inquiry to discover all representatives whose name of the second letter begins with ‘p’:
SELECT ename from employee where ename like '_p%';
Output:
ename
apoorv
Syntax:
Example 2: Write a question to discover all workers ids whose name’s very late letter closes with ‘I’:
SELECT eid from employee where ename like '%u_';
Output:
ename
apoorv