MySQL中 如何查询表名中包含某字段的表
查询tablename 数据库中 以"_copy" 结尾的表
select table_name from information_schema.tables where table_schema='tablename' and table_type='base table' and table_name like '%_copy';
information_schema 是MySQL系统自带的数据库,提供了对数据库元数据的访问
information_schema.tables 指数据库中的表(information_schema.columns 指列)
table_schema 指数据库的名称
table_type 指是表的类型(base table 指基本表,不包含系统表)
table_name 指具体的表名
如果本身是在tablename 这个库里新建的查询,可以去掉 table_schema='tablename ' 这一句
select table_name from information_schema.tables where table_type='base table' and table_name like '%_copy';
在Informix数据库中,如何查询表名中包含某字段的表
select * from systables where tabname like 'saa%'
此法只对Informix数据库有用
查询指定数据库中指定表的所有字段名column_name
select column_name from information_schema.columns where table_schema='csdb' and table_name='xxx'
检查数据库'test'中的某一个表'd_ad'是否存在
select count(1) from information_schema.tables where table_schema = 'test' and table_name = 'd_ad';
如何查询mysql数据库中有多少张表
select count(*) TABLES, table_schema from information_schema.tables where table_schema = 'test' group by table_schema;
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)