Free Newsletters:

SQLCourse
Interactive Online SQL Training

Search Database Journal:

HOME News MS SQL Oracle DB2 Access MySQL PHP SQL Etc Scripts Links Forums DBA Talk
SQL Courses
1
2
3
4
5
6
7
8
9
10
11
12
13
14


LIKE comparison test operator

SELECT first_column_name, second_column_name
FROM table_name
WHERE first_column_name LIKE 'Mc%';

The LIKE pattern matching operator can also be used in the conditional selection of the where clause. Like is a very powerful character string comparison operator that allows you to select only rows that are "like" what you specify. The percent sign "%" can be used as a wild card to match any possible character that might appear before or after the characters specified. For example:

select first, last, city
from empinfo
where first LIKE 'Mc%';

This SQL statement will match any first names that start with 'Mc'. Strings must be in single quotes.

Go Back to previous SELECT page


SQL Course Curriculum
<<previous 1234567891011121314 next>>