使用 LIKE 和 NOT REGEXP 显示表 [英] Show tables with LIKE and NOT REGEXP
本文介绍了使用 LIKE 和 NOT REGEXP 显示表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取数据库中以wp_
"开头但不以wp_X
"(其中X是数字)开头的所有表
I would like to get all tables in a database which start with "wp_
" but not with "wp_X
" (where X is a digit)
SHOW TABLES FROM database
WHERE Tables_in_database
LIKE 'wp_%' AND Tables_in_database
NOT REGEXP 'wp_[0-9]+%'
给我包括wp_2*
、wp_3*
、...
推荐答案
试试这个:
SHOW TABLES FROM database
WHERE Tables_in_database
LIKE 'wp_%' AND Tables_in_database
NOT REGEXP 'wp_[0-9]+'
即,从正则表达式中删除 %
字符.
ie, remove the %
character from regex.
这篇关于使用 LIKE 和 NOT REGEXP 显示表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文