Reputation: 11
I tried to run a SQL script in MySQL DB as below
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'ACT_%' OR TABLE_NAME LIKE 'IMS_PPH%';
In the response it is showing 'actor' and 'actor_info' table names even though I filtered with 'ACT_%'.
Upvotes: 1
Views: 46
Reputation: 9273
In MySQL, the underscore character ('_') is a wildcard that matches any character, which is why "ACT_" matches tables beginning with "ACT" followed by any character, which includes your "ACTOR" table.
If you want to treat "_" as a literal underscore, you must escape it, e.g. "ACT\_%".
Upvotes: 2