Reputation: 195
I need some help. I want to show database that has name "sample"
but except "sample"
with "fallback"
word.
Database Name
sample_1
2_sample
sample_fallback
samsple_2
s_sample
fallback_sample
I just want to get:
sample_1
2_sample
samsple_2
s_sample
What should I add from this query?
"SHOW DATABASES LIKE '%sample%';"
Upvotes: 0
Views: 867
Reputation: 108651
You're going to need to query the information_schema
directly to get this list.
select schema_name
from information_schema.schemata
where schema_name like '%sample%'
and schema_name not like '%fallback%'
SHOW DATABASES
isn't flexible enough.
Upvotes: 1
Reputation: 7123
SHOW DATABASES LIKE '%sample%' AND NOT LIKE '%fallback%';
Upvotes: 0