Sunday, 20 November 2011



SQL Wildcards can be used to searching for data in a database.
SQL wildcards must be use with the SQL LIKE operator.
SQL Wildcards can use for one or more characters when searching data in database.



WildcardsDescription
%substitute for 0 or more characters
2substitute for exactly one character
[Char_List]single character in Char List
[^Char_List]
or
[!Char_List]
single character not in Char List

& Wildcard Example

Example Statement:
Following SQL % wildcard S_Name can be start with 'J' from "Student_Details" table.
SQL> SELECT * FROM Student_Detail WHERE S_Name LIKE 'J%';
Example Result:

S_NoS_NameTotalPercentageAddressCity
1Jay50777.84BapunagarAhmedabad
4Jaimin46371.23ManinagarAhmedabad

_ Wildcard Example

Example Statement:
Following SQL _ wildcard S_Name can be any and after second character with 'a' from "Student_Details" table.
SQL> SELECT * FROM Student_Detail WHERE S_Name LIKE '_a%';
Example Result:

S_NoS_NameTotalPercentageAddressCity
1Jay50777.84BapunagarAhmedabad
4Jaimin46371.23ManinagarAhmedabad

[charlist] Wildcard Example

Example Statement:
Following SQL [charlist] wildcard S_Name can be started "A", "B", "D" in "Student_Detail" table.
SQL> SELECT * FROM Student_Detail WHERE S_Name LIKE '[ABD]%';
Example Result:

S_NoS_NameTotalPercentageAddressCity
2Ajay48774.92Modera Cross RoadMehsana
3Bhavesh46972.15Radhanpur Cross RoadMehsana
5Dolar42565.38PanchvatiAhmedabad

[^charlist] Wildcard Example

Example Statement:
Following SQL [^charlist] wildcard S_Name can be out of started "A", "B", "D" in "Student_Detail" table.
SQL> SELECT * FROM Student_Detail WHERE S_Name LIKE '[^ABD]%';
Example Result:

S_NoS_NameTotalPercentageAddressCity
1Jay50777.84BapunagarAhmedabad
4Jaimin46371.23ManinagarAhmedabad


SQL GUIDE 

0 comments:

Post a Comment

TrainingHUB. Powered by Blogger.

Total Pageviews

THE BEST QTP TRAINING INSTITUTE IN HYDERABAD

QTP Training in hyderabad

Sql Tutorial

Popular Posts

Our Facebook Page

TrainingHUB

Followers