Monday, February 8, 2010

SQL LIKE - Introduction and syntax

Explain the SQL LIKE statement. Write SQL syntax for the SQL LIKE statement along with an example.

LIKE clause is used for pattern matching. % is used to match any string of any length where as _ allows you to match on a single character.

Syntax:
SELECT * FROM table_name WHERE column_name like 'pattern%';

Example:
SELECT * FROM employee WHERE emp_name like 'ma%';

No comments:

Post a Comment