IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

More info about DB2 VIEWS


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 09, 2007 2:44 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Apr 09, 2007 2:49 pm
Reply with quote

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
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Mon Apr 09, 2007 3:11 pm
Reply with quote

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. icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Apr 09, 2007 3:18 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DB2 Views with Multiple SQL & Col... DB2 8
No new posts in REXX,how to get sysprt info CLIST & REXX 9
No new posts Copy a PDS to a new PDS - why do I ne... TSO/ISPF 8
No new posts Tivoli INFO/MANAGEMENT IBM Tools 1
No new posts Recreating VSAM cluster catalog info ... All Other Mainframe Topics 6
Search our Forums:

Back to Top