A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

f. 应尽量避免在 where 子句中对字段进行表达式操作,这将导致引擎放弃使用索引而进行全表扫描。如:
select id from t where num/2=100 应改为: select id from t where num=100*2
g. 应尽量避免在where子句中对字段进行函数操作,这将导致引擎放弃使用索引而进行全表扫描。如: select
id from t where substring(name,1,3)= ‘ abc’ – name 以 abc 开头 的 id select id from t where
datediff(day,createdate,’2005-11-30′)=0–‘2005-11-30’生成的 id 应改为: select id from t where name
like ‘abc%’ select id from t where createdate>=’2005-11-30′ and createdate<’2005-12-1′

3 个回复

倒序浏览
占座00000000000000
回复 使用道具 举报
11111111111111111111111111
回复 使用道具 举报
222222222222222222
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马