[DATABASE] VIEWS

  • Views are virtual tables derived from columns and rows from the base table.
  • Views provide what data are needed by the users, saving the trouble for users to understand the complexity and abstraction of the base tables.
  • Views are dynamic, updates in base tables will reflect on views.
  • Due to views only have limited access to columns and rows defined for users, update to views do not entirely reflect on base tables

Consider the following example, RENTAL_CUSTOMER relation contains custno, name and phone number, however user who is smith only requires to know his contents, we shall define a view for Smith:
Original base table:
Screenshot 2018-12-01 at 12.01.45 AM

Screenshot 2018-12-01 at 2.31.10 AM.png

This is what Smith will see from smith_view view:
Screenshot 2018-12-01 at 2.31.55 AM

Grant read and update permission to smith:
GRANT SELECT,UPDATE ON SMITH_VIEW TO SMITH;

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s