View previous topic :: View next topic
|
Author |
Message |
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Hi All,
Am aware of what views are and their use; And about views, i can find -
1) View is a virtual table residing in temporary memory.
2) Only the view definition itself is actually stored in the database.
Please help me to know something more than that...
----> Suppose we are creating view DEPT_VIEW for DEPARTMENT table as below, what would be the content of DEPT_VIEW?
CREATE VIEW DEPT_VIEW
AS SELECT * FROM DEPARTMENT
WHERE DEPT_SIZE > 25
Would it be holding all the rows (data) that statifies WHERE clause? If so where these data will be stored (as views are not stored in physical storage)? Also how does the data gets updated when rows are processed (inserted/deleted) in the table?
---> Please let me know whether my understanding is correct - Views will NOT hold data and each time DEPT_VIEW is referred (For eg. SELECT * FROM DEPT_VIEW), the query defined in CREATE VIEW statement (SELECT * FROM DEPARTMENT
WHERE DEPT_SIZE > 25) will be executed and resultant temporary table would be used for further processing. Hence Views contains or refer ONLY the Query we have defined in CREATE VIEW statement and is not directly related to holding table data.
Please correct me if am wrong. Thanks in advance!!! |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I think (if I understand you correctly) you are right....
In you example, just picture DEPT_VIEW as a shorthand way of saying
SELECT * FROM DEPARTMENT
WHERE DEPT_SIZE > 25 |
|
Back to top |
|
|
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Thanks William.
Then why all the notes i have referred are not pointing out this but simply saying as "Views look like and often behaves like base table". If it is referring just the query, then its behavior is unrelated with table behavior. Only the resulatant temporary table created through view would behave like a table. Also no one are projecting these points. Anyway thanks. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Shobana Bhaskar wrote: |
Then why all the notes i have referred are not pointing out this but simply saying as "Views look like and often behaves like base table". If it is referring just the query, then its behavior is unrelated with table behavior. Only the resulatant temporary table created through view would behave like a table. Also no one are projecting these points. |
William Thompson wrote: |
I think (if I understand you correctly) you are right.... |
Well, I guess I didn't... What is your question? |
|
Back to top |
|
|
|