WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

SQL LIKE Operator


The LIKE administrator watchword is helpful while determining an inquiry condition inside your WHERE clause.


The SQL LIKE Operator

The LIKE administrator watchword is helpful while determining an inquiry condition inside your WHERE clause.

SQL LIKE Syntax

SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern;

Database

In this instructional exercise we can utilize the outstanding database.

Below is a determination from the "Clients" table:

CustomerID FirstName Phone Username Password Email address
1

Roy K. Berry (03) 5379 4852 Thatiow ieV4Aitah RoyKBerry@dayrep.com
2 Josie J. Futrell (02) 4032 7368 Mdlisives40 ozuchaz7Ei JosieJFutrell@dayrep.com
3 James C. Walters (02) 4063 7155 Sincy1945 eer6Ooghie JamesCWalters@rhyta.com
4

Norma A. Jimenez (03) 5333 5321 Gode1942 Jeeh1rahPh NormaAJimenez@dayrep.com
5 Andrea J. Farmer (02) 9234 0059 Saydrund chai3Geel AndreaJFarmer@teleworm.us

SQL LIKE Operator Examples

The following SQL explanation chooses all clients with an Email address beginning with the letter "e":

Example

SELECT * FROM Customers
WHERE Email LIKE 'e%';

Tip: The "%" sign is utilized to characterize special cases  both when the example. "%" to coordinate a discretionary number of characters (counting zero characters). in the following chapter.

The following SQL articulation chooses all clients with an Email finishing with the letter "e":

Example

SELECT * FROM Customers
WHERE Email LIKE '%e';

The following SQL explanation chooses all clients with a Country containing the example "Better":

Example

SELECT * FROM Customers
WHERE Country LIKE '%Better%';

Using the NOT watchword enables you to choose records that don't coordinate the pattern.

The following SQL articulation chooses all clients with Password NOT containing the example "user":

Example

SELECT * FROM Customers
WHERE Password NOT LIKE '%user%';

The % special case can be utilized on numerous occasions inside the equivalent pattern.