--建立索引
create or replace view myview as
select create_date,salary from employee
--基于索引查询数据
select * from myview where create_date<20000 and salary between 1000 and 3000
完整代码:
-- Create table
create table EMPLOYEE
(
ID NUMBER not null,
NAME VARCHAR2(32),
SEX INTEGER,
CREATE_DATE NUMBER,
SALARY INTEGER
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table EMPLOYEE
add constraint EID primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
--建立索引
create or replace view myview as
select create_date,salary from employee
--基于索引查询数据
select * from myview where create_date<20000 and salary between 1000 and 3000