0 votes
in MariaDB by
What is the use of LIKE clause in MariaDB?

1 Answer

0 votes
by
MariaDB LIKE clause is used with SELECT, INSERT, UPDATE and DELETE statement to retrieve data when an operation needs an exact match.

It is used for pattern matching and returns 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 character: It matches a single character. It matches characters within its set.

Syntax:

SELECT field, field2,... FROM table_name, table_name2,...      

WHERE field LIKE condition        

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 which begins with "L".

SELECT name    

FROM Employees    

WHERE name LIKE 'L%';    

Mariadb like clause 2
...