If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Designing Views - which attributes are really nessecary?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-10, 05:33
dajense dajense is offline
Registered User
 
Join Date: Jul 2009
Posts: 17
Designing Views - which attributes are really nessecary?

Hi,

I have an application with a DB backend and I need to design views for the database. The way I understand it, views are good for two things:

- using access conditions in the where clause to restrict users from seeing rows they are not supposed to see

- cutting out attributes / coloumns which they don't need / should not see.

But I am finding it hard to decide which attribute a user needs. Say I have a table like Country(country_id, country_name, country_iso_code, language_id, currency_id).
The application would present the user only with name, iso-code, language and currency, but not with the IDs. However the application will need the IDs to provide this information. So, in this example, would you include the ID coloumns within the user view or would the view just present a join of all these attributes?

Thx.
Reply With Quote
  #2 (permalink)  
Old 01-05-10, 05:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
All requirements for your database design are driven by the applications. If the application needs an attribute, it must be part of the view definition - even if this attribute is used for application-internal processing only.

Btw, there are other uses for views:
  • separating the internal implementation of tables and the logical view presented to applications (e.g. you can denormalize 2 tables into a single table for fast access in some cases, but still provide 2 views that have the logical schema of the original tables - the application doesn't care what you have done under the covers)
  • access control on views is independent of the access control on the underlying tables
  • you can pre-formulate queries that join multiple tables
  • ...
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 01-05-10, 05:49
dajense dajense is offline
Registered User
 
Join Date: Jul 2009
Posts: 17
Thanks Stolze, that's exactly what I needed to know.

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On