themightystephen — 2006-08-22T08:57:27-04:00 — #1
Well my question is simple - I want to exclude tables with a certain prefix using this:
SHOW TABLES NOT LIKE 'history%'
With the prefix obviously being 'history'. I cannot understand why I get a nasty syntax error - it works when I have just LIKE rather than NOT LIKE but I want all the tables that are NOT like it.
r937 — 2006-08-22T09:44:59-04:00 — #2
SHOW TABLES is not part of sql, it's a mysql-proprietary command
you just have to live with the fact that they didn't include NOT in the SHOW TABLES syntax
themightystephen — 2006-08-22T09:54:37-04:00 — #3
Is there any way in MySQL to do the same thing?
r937 — 2006-08-22T10:08:48-04:00 — #4
do the same thing as what you wanted to do?
yes, if you're on 5.0+ you can query the "tables" table with a WHERE clause
hgouveia — 2011-02-23T03:37:11-05:00 — #5
SELECT table_name FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = 'the_db_name'
AND table_name NOT LIKE 'history%';