Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Show databases" with condition

Tags:

database

mysql

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?

like image 404
yosig81 Avatar asked Aug 25 '26 13:08

yosig81


1 Answers

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

Read more in the docs.

like image 143
gnud Avatar answered Aug 27 '26 05:08

gnud



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!