How To Use Wildcard Characters in MySQL statements

H

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:

About the author

Alvin Poh

I've over 17 years of entrepreneurship experience, having built a tech company to be the top in the country, which was subsequently acquired for an 8-figure sum. As CEO, I led the company through robust growth to 150 employees across 4 countries. After the acquisition, I embraced minimalism, sold off my personal possessions, and started living around the world.

Read more about my story here.

Add comment

By Alvin Poh

About Author

I've over 17 years of entrepreneurship experience, having built a tech company to be the top in the country, which was subsequently acquired for an 8-figure sum. As CEO, I led the company through robust growth to 150 employees across 4 countries. After the acquisition, I embraced minimalism, sold off my personal possessions, and started living around the world.

Read more about my story here.