bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL LIKE Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind SQL LIKE Keyword?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ * FROM Customers
3Order

Put the learning moves in the order that makes the concept easiest to apply.

- % - Represents zero, one, or multiple characters - _ - Represents a single character (MS Access uses a question mark (?
You can use two wildcards with LIKE :
The LIKE command is used in a WHERE clause to search for a specified pattern in a column.

Like

The LIKE command is used in a WHERE clause to search for a specified pattern in a column.

You can use two wildcards with LIKE :

  • % - Represents zero, one, or multiple characters
  • _ - Represents a single character (MS Access uses a question mark (?) instead)

The following SQL selects all customers with a CustomerName starting with "a":

Example

SELECT * FROM Customers

WHERE CustomerName LIKE 'a%';

The following SQL selects all customers with a CustomerName ending with "a":

Example

SELECT * FROM Customers

WHERE CustomerName LIKE '%a';

The following SQL selects all customers with a CustomerName that have "or" in any position:

Example

SELECT * FROM Customers

 WHERE CustomerName LIKE '%or%';

The following SQL statement selects all customers with a CustomerName that starts with "a" and are at least 3 characters in length:

Example

SELECT * FROM Customers

 WHERE CustomerName LIKE 'a__%';

Previous

SQL LEFT JOIN Keyword

Next

SQL SELECT TOP, LIMIT and ROWNUM Keywords