Reputation: 6852
I want to list all database which has the common starting word and after it should have uppercase letters. (using MYSQL)
eg:
test_vino_JY
test_vino_JI
test_vino_ij
test_vino_klm
In the above example i want to list only test_vino_JY, test_vino_JI
May i know how to do that. I tried using the below query, its not working. Please help me on this.
SHOW DATABASES WHERE `Database` REGEXP '^test_vino_+[A-Z]';
Upvotes: 2
Views: 58
Reputation: 360702
show
doesn't accept regexes, it only accepts a show foo like '%...%'
wildcard-type matches. You'll have to select against the information_schema
pseudo-db:
SELECT *
FROM information_schema.schemata
WHERE SCHEMA_NAME REGEXP '...';
Upvotes: 2