How To Use Wildcard Characters in MySQL statements

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%’

Similar Posts:

Alvin Poh lives in Singapore, and is interested in marketing, techy stuff, and likes to just figure out how the two can work with each other. He can also be found on Google+.

Leave a reply:

Your email address will not be published.


*

Sliding Sidebar