Skip to content

How To Use Wildcard Characters in MySQL statements

August 26, 2015

You’ll need to make use of wildcard characters to perform powerful searches in MySQL. The 2 wildcard characters that you can use in “LIKE”-queries in MySQL are:

% which matches 0 or more characters
_ which matches exactly one character

To search for a date, you can use a query like the following, which gives you everything that happened from 10 to 19 August of 2015, between 9:01am to 9:09am.

SELECT * FROM `yourTable` WHERE `datetime` LIKE ‘2015-08-1_ 09:0%’

Related Posts.