Session #, Speaker Name Views 1/2/2019.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Advertisements

Chapter 23 Database Security and Authorization Copyright © 2004 Pearson Education, Inc.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 12 System and Object Privileges.
Database Management System
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 4-1 David M. Kroenke Database Processing Chapter 7/8 Structured Query.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
Security and Transaction Management Pertemuan 8 Matakuliah: T0413/Current Popular IT II Tahun: 2007.
Database Systems More SQL Database Design -- More SQL1.
Security and Integrity
Chapter 6: Integrity and Security Thomas Nikl 19 October, 2004 CS157B.
©Silberschatz, Korth and Sudarshan6.1Database System Concepts Chapter 6: Integrity and Security Domain Constraints Referential Integrity Assertions Triggers.
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Week 6 Lecture 2 System and Object Privileges. Learning Objectives  Identify and manage system and object privileges  Grant and revoke privileges to.
Controlling User Access. Objectives After completing this lesson, you should be able to do the following: Create users Create roles to ease setup and.
Database Management COP4540, SCS, FIU Constraints and security in SQL (Ch. 8.6, Ch22.2)
Views Lesson 7.
Outline Introduction Basic SQL Setting Up and Using PostgreSQL
Access The L Line The Express Line to Learning 2007 L Line L © Wiley Publishing All Rights Reserved.
IS 230Lecture 6Slide 1 Lecture 7 Advanced SQL Introduction to Database Systems IS 230 This is the instructor’s notes and student has to read the textbook.
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.
DATA AND SCHEMA MODIFICATIONS CHAPTERS 4,5 (6/E) CHAPTER 8 (5/E) 1.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Chapter 13Introduction to Oracle9i: SQL1 Chapter 13 User Creation and Management.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Oracle 11g: SQL Chapter 7 User Creation and Management.
Chapter 4 The Relational Model Pearson Education © 2009.
SQL Triggers, Functions & Stored Procedures Programming Operations.
Database Security Advanced Database Dr. AlaaEddin Almabhouh.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Database System Implementation CSE 507
SQL Query Getting to the data ……..
More SQL: Complex Queries,
Chapter 6: Integrity (and Security)
Managing Privileges.
Managing Privileges.
Chapter 10 Views.
Insert, Update and the rest…
Database Security and Authorization
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
CS580 Advanced Database Topics
CSCI 52– Introduction to SQL Fall 2016
CIS 336 str Competitive Success/snaptutorial.com
CIS 336 str Education for Service- -snaptutorial.com.
CIS 336 str Teaching Effectively-- snaptutorial.com.
Module 5: Implementing Data Integrity by Using Constraints
CSCI 2141 – Intro to Database Systems
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Session #, Speaker Name Database Privileges 11/29/2018.
Chapter 2 Views.
Index Use Cases.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
The Relational Model Transparencies
Chapter 2 Views.
Chapter 4 The Relational Model Pearson Education © 2009.
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Chapter 4 The Relational Model Pearson Education © 2009.
Managing Privileges.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 9 Query-by-Example Pearson Education © 2009.
Prof. Arfaoui. COM390 Chapter 9
IST 318 Database Administration
So What are Views and Triggers anyway?
SQL-Views and External Schemas
Query-by-Example Transparencies
Views Base Relation View
Presentation transcript:

Session #, Speaker Name Views 1/2/2019

Views A view is a virtual table defined by a query. It provides a mechanism to create alternate ways of working with the data in a database. A view acts much like a table. We can query it with a SELECT, and some views even allow INSERT, UPDATE, and DELETE. A view doesn’t have any data. All of its data are ultimately derived from tables (called base tables). Views are similar to derived tables.

Create a View We can create a view using the CREATE VIEW command. CREATE VIEW <view name> [(<column list>)] AS <SELECT statement>

Create Views

Query Views

View may contain expressions

Views The view is just a virtual table, any changes to the base tables are instantly reflected in the view data.

Why Views Usability- we can use a view as a wrapper around very complex SELECT statements to make our system more usable. Security- if we need to restrict the data a user can access, we can create a view containing only the permitted data. The user is given access to the view instead of the base table(s). Reduced Dependency- the database schema evolves over time as our enterprise changes. Such changes can break existing applications that expect a certain set of tables with certain columns. We can fix this by having our applications access views rather than base tables. When the base tables change, existing applications still work as long as the views are correct.

Updating Views We can even perform INSERT, UPDATE, and DELETE on a view, which is propagated to the underlying tables; however, there are restrictions on the kinds of views that can be updated. Unfortunately, not all DBMSs allow updating through views. Even if your DBMS allows updates to views, you should be careful about using it, because some results may be unexpected.

Drop Views DROP VIEW <view name> [CASCADE | RESTRICT] This removes the specified view; however, it does not change any of the data in the database. SQL does not allow a view to be dropped if view is contained in the SELECT statement of another view. This is the default behavior or the result of using the RESTRICT option. To remove such a view, specify the CASCADE option. This will cause any dependent views to be removed before the view is dropped. According to the SQL specification, you must specify either CASCADE or RESTRICT with DROP VIEW. It is not optional. We present it as optional because most (if not all) DBMSs treat it as optional, with a default behavior of RESTRICT. For compliance with the SQL standard, it’s a good idea to specify either CASCADE or RESTRICT.

Summary Views are virtual tables whose columns and data are defined by a SELECT statement. You may SELECT from views just like any other table. Some views even allow INSERT, UPDATE, and DELETE. Updates to the base tables that a view is built from are immediately reflected in the view.

Practice

Session #, Speaker Name Questions? 1/2/2019