"Show databases" with condition

database, mysql

Solution

USE INFORMATION_SCHEMA;
SELECT `SCHEMA_NAME` from `SCHEMATA` WHERE `SCHEMA_NAME` LIKE "%whatever%";

Read more in the docs.

Problem

i would like to query a MySql Database to show me all the existing databases based on provided condition (condition applied on the database name). now since my condition is complex, the simple "LIKE" condition is not enough, and i need to use the regular WHERE clause. can anyone provide a sample of how to do that?

Original source