Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Thursday 13 September 2018

RLIKE OPERATOR Example

                  RLIKE OPERATOR IN MYSQL

In this tutorial, I will show you the use of RLIKE operator in MYSQL.

RLIKE Operator performs a pattern match of a string expression against a pattern. The pattern is supplied as an argument.


SYNTAX : 


SELECT COLUMN NAMES FROM
TABLE NAME 
WHERE COLUMN NAME RLIKE EXPRESSION;

Here expression is any valid expression;



EXAMPLE :
Query to fetch names  which have vowels (i.e., a, e, i, o and u) as both their first and last characters.


SELECT  *
FROM   (table name)
WHERE  name RLIKE '^[aeiouAEIOU].*[aeiouAEIOU]$';


No comments:

Post a Comment