like in sql

Today, We want to share with you like in sql.In this post we will show you sql-like case-insensitive, hear for not like in sql we will give you demo and example for implement.In this post, we will learn about sql like multiple words with an example.

SQL WHERE LIKE, SELECT WHERE LIKE Wildcard

In this tutorial we learn to all about like in sql Examples like as a SQL LIKE Operator, have “or” in any position, ending with “a”:, that have “r” in the second position:, with “a” and are at least 3 characters in length or many more.
Also Read: PHP MySQL LIKE operator string Function

Read Also:  sql where in list

The SQL LIKE Operator

SELECT * FROM Members
WHERE MemberName LIKE 'a%';

ending with “a”:

SELECT * FROM Members
WHERE MemberName LIKE '%a';

that have “or” in any position:

SELECT * FROM Members
WHERE MemberName LIKE '%or%';

that have “r” in the second position:

SELECT * FROM Members
WHERE MemberName LIKE '_r%';

with “a” and are at least 3 characters in length:

SELECT * FROM Members
WHERE MemberName LIKE 'a__%';

with a ProfileNm that starts with “a” and ends with “o”:

SELECT * FROM Members
WHERE ProfileNm LIKE 'a%o';

with a MemberName that does NOT start with “a”:

SELECT * FROM Members
WHERE MemberName NOT LIKE 'a%';

Example – Using % Wildcard in the LIKE Condition

SELECT *
FROM customers
WHERE sir_name LIKE 'J%'
ORDER BY sir_name;

Using Multiple % Wildcards in the LIKE Condition

SELECT sir_name
FROM customers
WHERE sir_name LIKE '%e%'
ORDER BY sir_name;

Example – Using _ Wildcard in the LIKE Condition

SELECT *
FROM categories
WHERE category_id LIKE '_5';

Example – Using the NOT Operator with the LIKE Condition

SELECT *
FROM suppliers
WHERE supplier_name NOT LIKE '%o%';

Example – Using Escape Characters with the LIKE Condition

SELECT *
FROM test
WHERE test_value LIKE '%!%%' escape '!';

Sample Queries and Outputs:

SELECT SupplierID, Name, Address
FROM Suppliers
WHERE Name LIKE 'Ca%';

I hope you get an idea about like in sql.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  Wordpress Open URL in New Tab programmatically

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Image Crop and Upload using jQuery and PHP
  2. Read Also:  sql group by count
  3. Read Also:  update multiple columns sql
  4. Read Also:  PHP Contact Form Send Email File Attachment Example
  5. Read Also:  how to use between in sql
  6. Read Also:  sql offset
  7. Read Also:  How to create a Login page with PHP and MySQL
  8. Read Also:  how to run sql query in command prompt?
  9. Read Also:  PHP MySQL ajax Autocomplete Live Search Box in jQuery
  10. Read Also:  Send Forgot password by mail or message in PHP