哈哈,今天又学到点知识:
create index 索引的第一列必须是select 语句的where 子句中指定的列之一 时才选择使用该索引.
如创建索引:create index date_index
on call_history (date_called,call_time,phone_number)
但在下列SQL 语句中不会选择date_index索引:
select * from tb where phone_number=2631070
必须是这样:
select * from tb where phone_number=date_called=getdate()
本文介绍了在SQL查询中,只有当create index索引的第一列被用作where子句的一部分时,该索引才会被选用。通过示例说明了正确与错误的索引使用方式。
2207

被折叠的 条评论
为什么被折叠?



