
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Retrieve records whenever a column value starts with 2 vowel letters in MySQL
Let us first create a table −
mysql> create table DemoTable664 (CityName varchar(100)); Query OK, 0 rows affected (0.89 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable664 values('Springfield'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable664 values('Austin'); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable664 values('Franklin'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable664 values('OAKLAND'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable664 values('Anchorage'); Query OK, 1 row affected (0.18 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable664;
This will produce the following output −
+-------------+ | CityName | +-------------+ | Springfield | | Austin | | Franklin | | OAKLAND | | Anchorage | +-------------+ 5 rows in set (0.00 sec)
Here is the query to use RLIKE/REGEXP pattern and display records whenever a column value starts with 2 vowel letters −
mysql> select *from DemoTable664 where CityName RLIKE '^[aeiouAEIOU][aeiouAEIOU]';
This will produce the following output −
+----------+ | CityName | +----------+ | Austin | | OAKLAND | +----------+ 2 rows in set (0.00 sec)
- Related Articles
- MongoDB query to retrieve records from a collection named with letters and numbers
- Sort data column to retrieve max textual value in MySQL
- Find records with double quotes in a MySQL column?
- Order a column in MySQL with IP Address records?
- MySQL query to count records that begin with specific letters
- Find records with a specific last digit in column with MySQL
- Select three random records with a fixed number of characters for each column value in MySQL
- How to retrieve a value with MySQL count() having maximum upvote value?
- Display distinct dates in MySQL from a column with date records
- How to update records in a column with random numbers in MySQL?
- Add a temporary column with a value in MySQL?
- Find specific records from a column with comma separated values in MySQL
- Return the first n letters of a column in MySQL
- MySQL query to display the count of distinct records from a column with duplicate records
- MySQL query to retrieve only the column values with special characters?

Advertisements