-
少用in或not in,连续数值可用between and替换,子查询用exists替换
-
少用like '%test%'
-
where条件是否可加索引
-
where条件左边字段尽量不要用函数
-
少用*,尽量用确定字段替换
-
少用or,尽量用union替换
-
少用is null或is not null,尽量设置默认值
-
一个表更新另一个表
//B表的一些字段用来更新A表 merge into Table_A A using Table_B B on 条件 when matched then updatesql [where] when not matched then insertsql