Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

DB2

Posted Jan 28, 2004

Understanding DB2 Nested Views - Page 4

By DatabaseJournal.com Staff

by Roman B. Melnyk and Paul C. Zikopoulos


Using the DB2 Control Center to Manage Views



The DB2 Control Center lets you conveniently access database objects, including views. Figure 3 shows the four views that we have created. They appear in the contents pane when Views is selected in the object tree.





Figure 3. The views that are associated with a particular database appear in the contents pane of the DB2 Control Center with Views selected in the object tree.



If we select MY_EMP_VIEW2, we can open the Show Related window to see the view dependencies (Figure 4), or the Alter View window to see the view definition and add or alter a comment that will be associated with the view (Figure 5).



Figure 4. The Show Related window displays MY_EMP_VIEW2's dependency relationships. Clicking the Tables tab shows the table on which the view is based. Clicking the Views tab shows MY_EMP_VIEW3, the view that depends on MY_EMP_VIEW2.

Figure 5. The Alter View window (which only allows you to alter the comment associated with a view) provides a convenient way to see the view definition (the SQL statement that was used to create the view). The same information can be obtained by querying SYSCAT.VIEWS in the database catalog.

Conclusion

Views are an effective way of limiting user access to data. Some views can be used to update data in the tables on which the views are based. Some views, called nested views, are based on other views. Updatable or insertable views can be defined to validate incoming data. In some cases, data validation can be made to cascade through nested views to give you maximum flexibility and integrity when managing your data.

About the Authors

Roman B. Melnyk, PhD, is with IBM Canada Ltd., specializing in database administration, DB2 utilities, and SQL. Roman has written numerous DB2 books, articles, and other related materials. Roman co-authored DB2 Version 8: The Official Guide, DB2: The Complete Reference, DB2 Fundamentals Certification for Dummies, and DB2 for Dummies. You can reach him at roman_b_melnyk at hotmail.com.

Paul C. Zikopoulos, BA, MBA, is with IBM Canada Ltd. Paul has written numerous magazine articles and books about DB2. Paul has co-authored the books: DB2 Version 8: The Official Guide, DB2: The Complete Reference, DB2 Fundamentals Certification for Dummies, DB2 for Dummies, and A DBA's Guide to Databases on Linux. Paul is a DB2 Certified Advanced Technical Expert (DRDA and Cluster/EEE) and a DB2 Certified Solutions Expert (Business Intelligence and Database Administration). You can reach him at: paulz_ibm at msn.com.



DB2 Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 



















Thanks for your registration, follow us on our social networks to keep up-to-date