Database - Introduction to SQL - Discussion
Discussion Forum : Introduction to SQL - General Questions (Q.No. 5)
5.
The wildcard in a WHERE clause is useful when?
Discussion:
16 comments Page 1 of 2.
Priyanka said:
1 decade ago
Wildcard is use to find SUBSTRING.
There are 3 methods for using these,
1) % It substitutes zero or more character.
Eg: select * from details where city LIKE 'ber%';
->It returns citynames start with 'ber'.
2) _ it substitutes only 1 character.
Eg: select * from details where city LIKE '_erlin';
->It returns cityname start with any character followed by 'erlin'.
3) [charlist] Sets range of character.
Eg: select * from details where city LIKE '[a-c]%';
->It returns cityname start with a,b or c .
There are 3 methods for using these,
1) % It substitutes zero or more character.
Eg: select * from details where city LIKE 'ber%';
->It returns citynames start with 'ber'.
2) _ it substitutes only 1 character.
Eg: select * from details where city LIKE '_erlin';
->It returns cityname start with any character followed by 'erlin'.
3) [charlist] Sets range of character.
Eg: select * from details where city LIKE '[a-c]%';
->It returns cityname start with a,b or c .
(6)
Anuradha tekam said:
7 years ago
Explain it answer clearly to get it.
(2)
Kailash Chandra said:
6 years ago
Select * From Student
Where student_name like "kai%";
This is the select all student name where name starts with "kai".
Where student_name like "kai%";
This is the select all student name where name starts with "kai".
(2)
Kondareddy said:
1 decade ago
Hello friends,
Answer is an exact match is not possible in a select statements. Because if you want to display the name start with 'sa'. But unfortunately our database have 4 records start with sa. For this you write query like this select ename from emp where ename like 'sa%';
Here 4 records are displayed so we can't find the exact match.
Answer is an exact match is not possible in a select statements. Because if you want to display the name start with 'sa'. But unfortunately our database have 4 records start with sa. For this you write query like this select ename from emp where ename like 'sa%';
Here 4 records are displayed so we can't find the exact match.
(1)
Pritam Gupta said:
10 years ago
Wild card basically use for missing character. Suppose there are 100 employee, and I want those employee whose name end with 'M' than I am writing like this:
Select EMP_NAME from EMPLOYEE where EMP_NAME like '%M';
Then I will get all employee name whose end character is M.
Select EMP_NAME from EMPLOYEE where EMP_NAME like '%M';
Then I will get all employee name whose end character is M.
(1)
Hans said:
9 years ago
"The wildcard in a WHERE clause" makes no sense whatsoever. The WHERE clause has not "wildcards". The LIKE operator supports wildcards, but not the WHERE clause (and together with CREATE the term wildcard makes even less sense).
(1)
Anil said:
1 decade ago
In case of char variables the exact match may not be possible. In those cases we use % wildcard.
L.Srinivas said:
1 decade ago
Can you elaborate in detail please.
Jaba said:
1 decade ago
Wildcard chars are used to replace any substring.for eg if you want to write a query to get the names which starts with s, we can write it as select * from employee where name LIKE "s%" and - replace single character.
Khushboo jain said:
1 decade ago
Please give the answer in more detail.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers