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

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.

Leave a Comment