简体   繁体   中英

How virtual views are not stored on database

AS we know major difference between view and materialized view is- views are not stored on database and materialized views are stored physically on database. But it will give output in below example.

eg I have base table emp having 5 fields and I created v_emp view based on this table with only 3 required fields. and I run below query it gives correct output

desc v_emp;

My question is: if views are not stored anywhere on database from where it fetches data.

Note: I am using Oracle database

AFAIK, view is nothing but stored/saved query. So it's doesn't store any data and every time you run the view saying select * from v_emp behind the scene it run the underline select query saying select fld1, fld2, fld3 from employee;

Views ARE stored in the database. There are two main components of a view:

1) The definitions of the view... as in the select statement(for both types of views).

2) The physical storage of actual rows in the database (materialized views only).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM