Views.

Slides:



Advertisements
Similar presentations
DB glossary (focus on typical SQL RDBMS, not XQuery or SPARQL)
Advertisements

Views-basics 1. 2 Introduction a view is a perspective of the database different users may need to see the database differently; this is achieved through.
1 Term 2, 2004, Lecture 6, Views and SecurityMarian Ursu, Department of Computing, Goldsmiths College Views and Security 3.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Keys  SuperKey  a set of attributes whose values together uniquely identify a tuple in a relation  Candidate Key  a superkey for which no proper subset.
Integrity Constraint Management CS2312. The correctness and consistency of the data and its information  Implicit  of the data model  specified and.
1 Query Languages: How to build or interrogate a relational database Structured Query Language (SQL)
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
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.
INTEGRITY Enforcing integrity in Oracle. Oracle Tables mrobbert owner granted access.
Data Definition, Relational Manipulation and Data Control Using SQL.
Security and Integrity
The Relational Model. Review Why use a DBMS? OS provides RAM and disk.
Relational Query Languages. Languages of DBMS  Data Definition Language DDL  define the schema and storage stored in a Data Dictionary  Data Manipulation.
Database Technical Session By: Prof. Adarsh Patel.
Introduction to Database Systems Mapping ER Models to Relational Schemas Irvanizam Zamanhuri, M.Sc Informatics (Computer Science) Study Program Syiah Kuala.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Chapter 2 Views. Objectives ◦ Create simple and complex views ◦ Creating a view with a check constraint ◦ Retrieve data from views ◦ Data manipulation.
1 Chapter 6 Database Administration. 2 Introduction Database administration The process of managing a database Database administrator A person or an entire.
Fall 2001Database Systems1 Triggers Assertions –Assertions describe rules that should hold for a given database. –An assertion is checked anytime a table.
Indexes and Views Unit 7.
McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. What is a View? Derived table Behaves like a base table (virtual) Stored.
Chapter 13 Views Oracle 10g: SQL. Oracle 10g: SQL2 Objectives Create a view, using CREATE VIEW command or the CREATE OR REPLACE VIEW command Employ the.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
CS34311 The Relational Model. cs34312 Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still used IBM’s.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Roles in the Database Environment
Chapter 6: Integrity (and Security)
The Basics of Data Manipulation
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
CS 480: Database Systems Lecture 13 February 13,2013.
PL/SQL LANGUAGE MULITPLE CHOICE QUESTION SET-1
SQL Creating and Managing Tables
Foreign Keys Local and Global Constraints Triggers
CS580 Advanced Database Topics
ITEC 313 Database Programming
Creating Views Schedule: Timing Topic 20 minutes Lecture
Translation of ER-diagram into Relational Schema
CPSC-310 Database Systems
Integrity Constraint Management
SQL Creating and Managing Tables
Chapter 2 Database Environment.
What Is a View? EMPNO ENAME JOB EMP Table EMPVU10 View
SQL Creating and Managing Tables
Chapter 5 Sequences.
Chapter # 7 Introduction to Structured Query Language (SQL) Part II.
The Basics of Data Manipulation
SQL Views and Updates cs3431.
Advanced SQL: Views & Triggers
Chapter 4 Indexes.
CH 4 Indexes.
Chapter 2 Views.
Index Use Cases.
Databases.
CH 4 Indexes.
Chapter 2 Views.
Structured Query Language (3)
Relational Database Design
Chapter 11 Managing Databases with SQL Server 2000
IST 318 Database Administration
So What are Views and Triggers anyway?
Integrity 5/5/2019 See scm-intranet.
SQL-Views and External Schemas
Views.
CSC 453 Database Systems Lecture
Presentation transcript:

Views

External View of Ansi-Sparc Architecture In most relational DBMS a view is a virtual relation which acts as a dynamic window on the base relations Materialised views are a research issue and raise consistency issues A view can be queried as if it were a base relation, but may not be updatable as if it were a base relation

Views are recomputed from the base relations each time they are used Views are useful for logical data independence simplification security integrity management

Views: Security View Base Relation create view cs_students as Can use view like a base relation Query modification create view cs_students as (select studno, name, tutor,year from student where hons = ‘cs’);

Views: Query Simplification create view course_staff as (select courseno,subject, staff.lecturer, roomno from course, staff where course.lecturer = staff.lecturer);

Views: Query Simplification Course_Totals un-updateable create view coursetotals as (select courseno,count(*) from enrol group by courseno);

Updatability of Views (Oracle 8) If the view query contains any of the following constructs it is not inherently modifiable, and you therefore cannot perform inserts, updates, or deletes on the view: set operators group functions the DISTINCT operator joins (a subset of join views are updatable if they are key-preserving- all keys to base tables must be in view and the keys in the view must still be unique and not null) If a view contains pseudocolumns or expressions, you can only update the view with an UPDATE statement that does not refer to any of the pseudocolumns or expressions.

Views: Logical Data Independence Restructured Database create view student as (select sd.studno, name, hons, tutor, year, totalaverage from student_details sd, marks where sd.studno = marks.studno);

Views: Data Integrity create view cs_students as (select studno, name, tutor, year from student where hons = ‘cs’) with check option constraint cs; Check option enforces the constraint that any insert or update on the view satisfy the where clause