首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

SQL生手求教这段有无优化空间

2012-08-02 
SQL新手求教这段有无优化空间?SQL codecreate temporary table tbd(id int) select id from d where para

SQL新手求教这段有无优化空间?

SQL code
create temporary table tbd(id int) select id from d where para <> 1234;delete from t1 where id in (select id from tbd);delete from t2 where id in (select id from tbd);delete from t3 where id in (select id from tbd);delete from t4 where id in (select id from tbd);drop table tbd;


新手求教,有无改进空间?怎么改进?

[解决办法]
delete t1 from t1,d where t1.id=d.id;
delete t1 from t2,d where t2.id=d.id;
delete t1 from t3,d where t3.id=d.id;
delete t1 from t4,d where t4.id=d.id;
[解决办法]
explain ...不就知道了吗
[解决办法]
探讨

引用:

delete t1 from t1,d where t1.id=d.id;
delete t1 from t2,d where t2.id=d.id;
delete t1 from t3,d where t3.id=d.id;
delete t1 from t4,d where t4.id=d.id;


这样直接删除,比先select出来再删除快吗?……

热点排行