From the course: MySQL Essential Training
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Regular expressions - MySQL Tutorial
From the course: MySQL Essential Training
Regular expressions
- [Bill] Hi, I'm Bill Weinman. Regular expressions is a pattern matching language for searching text, often called RegEx. It was popularized in UNIX tools like grep, awk and sed, and became more widely used in the language Perl. Today, many tools support regular expressions, including MySQL. For this lesson, we'll use the world database, so I'll type USE world and execute that to open the world database. Now, if I want to find all the countries in the country table that end in Y, I can use a regular expression like this, select name from country WHERE name RLIKE. And so that's like the like clause, but with an R in front of it for regular expressions. Y dollar sign, which is a regular expression that says this string must end in Y. Order by name and when I execute that, I get all the countries in the database that end in Y. So that's pretty simple. Let's do a more complicated one, and this will show you a little bit about the power of regular expressions. Regular expressions are…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.