SQL语句创建针对表TblForIndex的 唯一 索引
create unique index idx_Id on TblForIndex(Id); -- idx_Id 是索引名字 -- TblForIndex 是表名,Id 是栏位名称
创建多列索引
create index idx_Id_Empno on TblForIndex(Id, Empno);
指定列的排序规则,默认都是升序,如何指定降序呢?
其实只需要在列字段后面加上排序规则即可,升序使用asc,降序使用desc
create index idx_Id_EmpName on TblForIndex(Id asc, EmpName desc);
删除索引
drop index idx_Id_EmpName; -- idx_Id_EmpName 是索引名字