Javatpoint Logo
Javatpoint Logo

MariaDB LIKE Clause

In MariaDB, LIKE clause is used with SELECT statement to retrieve data when an operation needs an exact match. It can be used with SELECT, INSERT, UPDATE and DELETE statement.

It is used for pattern matching and return a true or false. The patterns used for comparison accept the following wildcard characters:

"%" wildcard character: It matches numbers of characters (0 or more).

"_" wildcard charcter: It matches a single character. It matches characters within its set.



Using % wildcard (percent sign wildcard)

We have a table "Employees", having the following data.

Mariadb like clause 1

Let's use % wildcard with LIKE condition to find all of the names who begins with "L".



Mariadb like clause 2

You can also use the % wildcard multiple times within the same string.



Mariadb like clause 3

It will return all names which contains "L" within.

Using _ wildcard (underscore wildcard)

Let's use _ wildcard with LIKE condition. The underscore wildcard checks only one character. Let's fetch name of the employee which is like "Ra_ul".


Mariadb like clause 4

LIKE Clause with NOT operator

In MariaDB, you can use NOT operator with LIKE clause. Let's use the % wilcard with the NOT Operator. Here we find out employees whose name does not start with 'A'.


Mariadb like clause 5
Next TopicMariaDB Order By

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA