Presentation is loading. Please wait.

Presentation is loading. Please wait.

View Sen Zhang. Views are very common in business systems users view of data is simplified a form of security - user sees only the data he/she needs to.

Similar presentations


Presentation on theme: "View Sen Zhang. Views are very common in business systems users view of data is simplified a form of security - user sees only the data he/she needs to."— Presentation transcript:

1 View Sen Zhang

2 Views are very common in business systems users view of data is simplified a form of security - user sees only the data he/she needs to if the primary key is preserved, updates to a base table through a view is possible, but usually not.

3 Creating and Using Database Views Similar to storing the result of a query in the database Based on a source query that: –can specify a subset of a single table’s fields or records –can join multiple tables Can be used to enforce security (user has access to view but not underlying table)

4 Views: Use a Create View command essentially a select specifying the data that makes up the view Create View Enames as select lname, fname from employee CREATE VIEWEnames (lname, fname) AS SELECTLNAME, FNAME FROMEMPLOYEE create Create or replace view … as…

5 Once correctly created, Views are used like tables for selecting, inserting, updating and deleting data (only updatable views can be modified. You won’t be tested for this feature!)

6 Creating and Using Database Views In Oracle, views can be updateable if: –SELECT clause contains only fieldnames, no functions or calculations –cannot contain the ORDER BY, DISTINCT, or GROUP BY clauses, group functions, or set operators –search condition cannot contain a nested query

7 Creating and Deleting Views CREATE OR REPLACE VIEW view_name AS source_query; DROP VIEW viewname;

8 Drop view

9 Alter view

10 Summary Queries can be “saved” by creating a view Views can be used like tables to select, insert, update and delete data


Download ppt "View Sen Zhang. Views are very common in business systems users view of data is simplified a form of security - user sees only the data he/she needs to."

Similar presentations


Ads by Google