摘要: -- 查询某一库中所有表的名称, SELECT a.TABLE_SCHEMA ,a.TABLE_NAME ,a.TABLE_COMMENT FROM information_schema.`TABLES` a WHERE a.table_type = 'BASE TABLE' AND a.TABLE 阅读全文
posted @ 2023-08-17 10:06 yikes_ygr 阅读(77) 评论(0) 推荐(0) 编辑
摘要: -- 查询构建批量删除表语句(根据数据库名称) ``` select concat('delete from ', TABLE_NAME, ' where org_id = "" ', ';') from information_schema.TABLES where TABLE_SCHEMA = 阅读全文
posted @ 2023-07-11 00:14 yikes_ygr 阅读(15) 评论(0) 推荐(0) 编辑
摘要: -- 添加联合唯一索引 alter table b_report_file add unique index nc (`name`, `code`, `org_id`); -- 删除索引 ALTER TABLE b_report_file DROP INDEX nc; 阅读全文
posted @ 2023-06-16 15:49 yikes_ygr 阅读(12) 评论(0) 推荐(0) 编辑
摘要: #### 一、代码 ``` -- 报工设置,添加数据 set @org_id = '租户id'; set @created_user = 'yike'; set @updated_user = 'yike'; set @dispatch_list_id = ; set @process_name = 阅读全文
posted @ 2023-06-07 14:21 yikes_ygr 阅读(55) 评论(0) 推荐(0) 编辑
摘要: #### 一、输入查询语句,查看是否有数据被上锁 - select * from information_schema.innodb_trx; ![image](https://img2023.cnblogs.com/blog/2468225/202305/2468225-2023052411402 阅读全文
posted @ 2023-05-24 11:41 yikes_ygr 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 一、sql清空表数据的三种方式: 1、truncate – 删除所有数据,保留表结构,不能撤销还原,速度快 2、delete – 是逐行删除,不适合大量数据删除,速度极慢 3、drop – 删除表,表数据和表结构一起删除,速度快 二、语法 truncate table <表名>; delete fr 阅读全文
posted @ 2023-05-12 17:51 yikes_ygr 阅读(167) 评论(0) 推荐(0) 编辑