By 25/02/2016 1 Comments

What Is LIKE Operator In SQL?

  • The LIKE operator is used to search values of column by using a specific search pattern in database table.
  • The LIKE operator is used with a WHERE clause.

Syntax:

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

Example-1: Following SQL query selects all products with a p_name column starting with a letter “l”.

SELECT *
FROM products
WHERE p_name LIKE "l%";

Example-2: Following SQL query selects all products with a p_name column ending with a letter “p”.

SELECT *
FROM products
WHERE p_name LIKE "%p";

Example-3: Following SQL query selects all products with a p_name column containing the pattern “top”:

SELECT *
FROM products
WHERE p_name LIKE "%top%";

Example-4: Following SQL query selects all products with a p_name column not containing the pattern “top”:

SELECT *
FROM products
WHERE p_name NOT LIKE "%top%";






← Previous Tutorial


Posted in: Sql

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .