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 @ 2021-09-15 15:38  kht  阅读(50)  评论(0编辑  收藏  举报