mysql: What is the right syntax for NOT LIKE?

后端 未结 3 1272
后悔当初
后悔当初 2020-12-15 22:19

Hi I am trying to show tables with names not like a pattern by mysql is throws an error:

SHOW TABLES  NOT LIKE  \"tree%\";

returns:

3条回答
  •  暖寄归人
    2020-12-15 23:07

    You could use the WHERE clause extension, as in:

    SHOW TABLES WHERE `Tables_in_` NOT LIKE 'tree%';
    

    This is supported on MySQL ≥5.0.

    Reference:

    • 12.4.5.39. SHOW TABLES Syntax.
    • 20.28. Extensions to SHOW Statements.

提交回复
热议问题