sql 索引如何起到优化查询的

2025-03-04 01:15:18
推荐回答(1个)
回答1:

create index index_name on table_name(column_name) ;
只要你查询使用到建了索引的字段,一般都会用到索引。

--创建表
create table aaa
(
a number,
b number
);
--创建索引
create index idx_a on aaa (a);
--使用索引
select * from aaa where a=1;
这句查询就会使用索引 idx_a