mysql常用sql语句

复制1.根据表注释模糊查询对应的表:
select table_name,table_comment from information_schema.tables where table_comment like '%业务归属%';
2.查询指定库拥有某字段的表
columnName 字段名   dbName 数据库名
AND TABLE_NAME NOT LIKE 'vw%'  排除视图
select distinct table_name from information_schema.columns where column_name = 'columnname' and table_schema='dbname' and table_name not like 'vw%';
3.查询指定数据库所有的表名
select table_name from information_schema.tables where table_schema='dbName' and table_type='base table';
4.查询指定数据库没有某字段的所有表
select table_name from information_schema.tables where table_schema='dbname' and table_type='base table'
and table_name not in(
    select distinct table_name  from information_schema.columns where column_name = 'culumnname' and table_schema='dbname' and table_name not like 'vw%'
);
复制--1.查看那些表锁到了
show OPEN TABLES where In_use > 0;
--2.查看进程号
show processlist;
--3.杀死进程
 kill 1085850;
posted @   kht  阅读(51)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
点击右上角即可分享
微信分享提示