房地产怎么做网站推广,企业解决方案案例分析,惠州网站建设l优选蓝速科技,百度提交入口网站1.索引分类a) 唯一索引, 作用是数据约束#xff0c;保证数据唯一#xff0c;还有就是数据索引#xff0c;提高查询效率b)一般索引#xff0c;只有数据索引的作用#xff0c;2.唯一索引的建立create unique index 索引名on 表名(字段名)ok,假设有一个Emploeyy表#xff0c…1.索引分类a) 唯一索引, 作用是数据约束保证数据唯一还有就是数据索引提高查询效率b)一般索引只有数据索引的作用2.唯一索引的建立create unique index 索引名on 表名(字段名)ok,假设有一个Emploeyy表里面有一个empName字段我们来为empName添加唯一索引create uniqueindex idx_empname on employee(empname)3.一般索引create index 索引名 on 表名(字段名)ok,现在我们为employee的address字段添加一般索引create index idx_address onemployee(address);我们还可以为两多个字段建立索引create unique index idx_test on employee(field1,field2);这样为field1,field2添加了唯一索引field1和field2的组合是唯一的了还可以指定索引排序create indexidx_test employee(field1 ,field2 desc);;4.函数索引如果在我们的查询条件使用了函数那么索引就不可用了。可以用建立函数索引的方式来解决这个问题例如:select * from product where nvl(price,0.0)1000.0;这里nvl(price,0.0)使用了函数索引不能利用price字段上做的索引了ok,我们来创建函数索引create index index_price on product(nvl(price,0.0));5.索引的删除drop index 索引名drop index idx_empname;6.其它的唯一索引能极大的提高查询速度而且还有唯一约束的作用一般索引只能提高30%左右的速度经常插入修改应在查询允许的情况下尽量减少索引因为添加索引插入修改等操作需要更多的时间可以在order by的字段where的条件字段join的关联字段添加索引比如:select * from table1 t1left join table2 t2 ont1.字段At2.字段Bwhere t1.字段C 值order by t1.字段D这里A,B,C,D字段都应该添加索引