MySQL

adplus-dvertising
Wildcard in MySQL
Previous Home Next

They are the chararcters which provides a easiy way to search any pattern or string in the specified column. Wildcards can be use within two functions only, they are

  1. Like
  2. Rlike

The Like is already discussed in the previous page or you can click on this link

Rlike

It performs some category , whose description is given below in the below table

TypeDescription
^Define begining of the string
$Define ending of the string
| OR Conditions

Syntax

SELECT *   
FROM tablename  
WHERE Clause 
RLIKE 'type_define';

The '^' defines the starting of the string followed by the character ' s ' define and display all the result.

Example

SELECT *
FROM studinfo 
WHERE lname
RLIKE '^s' ;

The '$' defines the ending of the string followed by the character ' a ' define and display all the result.

Example

SELECT *
FROM studinfo 
WHERE lname
RLIKE 'a$' ;

The '|' defines the OR type in the string and display all the result.

Example

SELECT *
FROM studinfo 
WHERE lname
RLIKE 'sharma|saxena' ;
Previous Home Next