如何查找出一个数据库中所有表名包含某个关键词的表名的列表

mysql或oracle
2024-12-10 13:26:05
推荐回答(2个)
回答1:

用like语句查询。

SQL Server语法如下(如查询包含spt的表)

select name from sys.objects where type='U' and name like '%spt%';

结果:

Oracle语法如下(如查询包含test的表)

select table_name from user_tables where table_name like '%TEST%';

结果:

注意:Oracle中,表名处的字母一定要大写。

回答2:

oracle:select * from user_tables where table_name like '%S%'; 'S'为包含的关键字