Views:
======
1) Normal Views, Complex views
2) Materialized Views
3) Inline Views
select * from employees;
create or replace view view_name
select columns from base_table where condition;
create or replace view emp_v
as select employee_id,first_name,email,hire_date,salary*12 new_salary,department_id
from employees where salary >12000;
select * from emp_v;
insert into emp_v values (500,’jfdsfld’,’dsfdfasd’,’dfdsfds@gmail’,sysdate,20);
create or replace view emp_v
as select a.employee_id,
a.first_name,
a.email,
a.phone_number,
a.salary,
a.department_id,
d.department_name,
a.rank from
(select employee_id,first_name,email,phone_number,salary,department_id,
rank() over(order by salary desc) “RANK” from employees) a inner join departments d
on a.department_id=d.department_id where a.rank <=5 order by a.rank;
select rowid,e.* from emp_v e;
AAAEATAAEAAAADNAAA
AAAEATAAEAAAADNAAB
AAAEATAAEAAAADNAAC
AAAEATAAEAAAADNAAt
AAAEATAAEAAAADNAAu
AAAEATAAEAAAADNAAA
AAAEATAAEAAAADNAAB
AAAEATAAEAAAADNAAC
select rowid,e.* from employees e;
——————————————————————————–
–Materialized Views
— Inline Views
——————————————————————————–
index:
* Faster Data retrival
create index index_name
on table_name (column_name);
create index emp_idx22
on employees(salary);
——————————————————————————