Write a mysql statement to retrieve name beginning with 'm'
Suppose the table is -
+----+--------------+------------+------------+
| id | name | department | birth |
+----+--------------+------------+------------+
| 1 | Maria Gloria | CS | 1994-03-12 |
| 2 | John Smith | IT | 1993-02-07 |
| 3 | Gal Rao | CS | 1992-09-11 |
| 4 | Jakey Smith | EC | 1990-08-31 |
| 5 | Rama Saho | IT | 1994-12-09 |
| 6 | Maria Gaga | EC | 1993-10-09 |
+----+--------------+------------+------------+
Solution
To apply extended regular expression, REGEXP operator is used with pattern matching characters.
To find names beginning with 'm', use ^ to match the beginning of the name. It returns 1 if the string expr matches the regular expression specified by the pattern 'm', 0 otherwise.
Output of the above statement -
need an explanation for this answer? contact us directly to get an explanation for this answer+----+--------------+------------+------------+ | id | name | department | birth | +----+--------------+------------+------------+ | 1 | Maria Gloria | CS | 1994-03-12 | | 6 | Maria Gaga | EC | 1993-10-09 | +----+--------------+------------+------------+