Introduction to Oracle9i: SQL1 Views. Introduction to Oracle9i: SQL2 Chapter Objectives Create a view, using CREATE VIEW command or the CREATE OR REPLACE.

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

View (virtual table). View A VIEW is a virtual table A view contains rows and columns, just like a real table. The fields in a view are fields from one.
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Database Systems: Design, Implementation, and Management Tenth Edition
Introduction to Structured Query Language (SQL)
Introduction to Oracle9i: SQL1 Subqueries. Introduction to Oracle9i: SQL2 Chapter Objectives Determine when it is appropriate to use a subquery Identify.
10 Copyright © 2004, Oracle. All rights reserved. Creating Other Schema Objects.
Introduction to Structured Query Language (SQL)
Database Systems More SQL Database Design -- More SQL1.
View and Materialized view. What is a view? Logically represents subset of data from one or more table. In sql, a view is a virtual relation based on.
Introduction to Structured Query Language (SQL)
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 7 Introduction to Structured Query Language (SQL)
Chapter 5 Data Manipulation and Transaction Control Oracle 10g: SQL
Chapter 6 Additional Database Objects
Concepts of Database Management Seventh Edition
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Copyright © 2004, Oracle. All rights reserved. Lecture 3: Creating Other Schema Objects Lecture 3: Creating Other Schema Objects ORACLE.
11 Copyright © 2007, Oracle. All rights reserved. Creating Other Schema Objects.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 6 Functions.
PL/SQLPL/SQL Oracle11g : PL/SQL Programming Chapter 6 Functions.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
11 Copyright © Oracle Corporation, All rights reserved. Creating Views.
Database Programming Sections 11 & 12 – Creating, and Managing Views, Sequences, Indexes, and Synonymns.
Views In some cases, it is not desirable for all users to see the entire logical model (that is, all the actual relations stored in the database.) In some.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 7 Introduction to Structured.
Chapter 2 Views. Objectives ◦ Create simple and complex views ◦ Creating a view with a check constraint ◦ Retrieve data from views ◦ Data manipulation.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 9 Constraints. Chapter Objectives  Explain the purpose of constraints in a table  Distinguish among PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK,
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Chapter 12 Subqueries and Merge Statements
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.
Copyright  Oracle Corporation, All rights reserved. 12 Creating Views.
ITEC 3220A Using and Designing Database Systems Instructor: Prof. Z. Yang Course Website: 3220a.htm
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Chapter 12 Additional Database Objects. Chapter Objectives  Define the purpose of a sequence and state how it can be used by an organization  Explain.
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.
Creating Views Database Systems Objectives Explain the concept of a view. Create simple and complex views. Retrieve data through a view. Alter the.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Chapter 12Introduction to Oracle9i: SQL1 Chapter 12 Additional Database Objects.
Copyright س Oracle Corporation, All rights reserved. 12 Creating Views.
Oracle9i Developer: PL/SQL Programming Chapter 5 Functions.
Chapter 7 SQL HUANG XUEHUA. Chapter Objectives Specification of more general constraints via assertions SQL facilities for defining views (virtual.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
SQL Triggers, Functions & Stored Procedures Programming Operations.
 CONACT UC:  Magnific training   
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Chapter 12 Subqueries and MERGE Oracle 10g: SQL
Introduction to Oracle9i: SQL
Creating Views Schedule: Timing Topic 20 minutes Lecture
Chapter # 7 Introduction to Structured Query Language (SQL) Part II.
Chapter 2 Views.
Database Programming Sections 11 – Creating, and Managing Views, Sequences, Indexes, and Synonymns.
Chapter 7 Introduction to Structured Query Language (SQL)
SQL DATA CONSTRAINTS.
A Guide to SQL, Eighth Edition
SQL .. An overview lecture3.
Chapter 2 Views.
Contents Preface I Introduction Lesson Objectives I-2
Prof. Arfaoui. COM390 Chapter 6
IST 318 Database Administration
Presentation transcript:

Introduction to Oracle9i: SQL1 Views

Introduction to Oracle9i: SQL2 Chapter Objectives Create a view, using CREATE VIEW command or the CREATE OR REPLACE VIEW command Employ the FORCE and NO FORCE options State the purpose of the WITH CHECK OPTION constraint

Introduction to Oracle9i: SQL3 Chapter Objectives Explain the effect of the WITH READ ONLY option Update a record in a simple view Re-create a view Explain the implication of an expression in a view for DML operations Update a record in a complex view

Introduction to Oracle9i: SQL4 Chapter Objectives Identify problems associated with adding records to a complex view Identify the key-preserved table underlying a complex view Drop a view Explain inline views and the use of ROWNUM to perform a “TOP-N” analysis

Introduction to Oracle9i: SQL5 Views Permanent objects that store no data Display data contained in other tables Two purposes: –Reduce complex query requirements for novice users –Restrict users’ access to sensitive data

Introduction to Oracle9i: SQL6 Types of Views

Introduction to Oracle9i: SQL7 CREATE VIEW Command Use OR REPLACE if view already exists Use FORCE if underlying table does not exist at time of creation Provide new column names if necessary

Introduction to Oracle9i: SQL8 CREATE VIEW Options WITH CHECK OPTION constraint – if used, prevents data changes that will make the data subsequently inaccessible to the view WITH READ ONLY – prevents DML operations

Introduction to Oracle9i: SQL9 Simple View Only references one table – no group functions, GROUP BY clause, or expressions

Introduction to Oracle9i: SQL10 Simple View – DML Operations Any DML operations are allowed through simple views unless created with WITH READ ONLY option DML operations that violate constraints on the underlying table are not allowed

Introduction to Oracle9i: SQL11 Complex View May contain data from multiple tables or data created with the GROUP BY clause, functions, or expressions Type of DML operations allowed depends on various factors

Introduction to Oracle9i: SQL12 DML Operations - Complex Views with Expressions Values cannot be inserted into columns that are based on arithmetic expressions

Introduction to Oracle9i: SQL13 DML Operations – Complex Views from Multiple Tables DML operations can not be performed on non key-preserved tables, but they are permitted on key-preserved tables

Introduction to Oracle9i: SQL14 DML Operations – Other Complex Views No DML operations are permitted on complex views based on DISTINCT, ROWNUM, GROUP BY, or a function

Introduction to Oracle9i: SQL15 Dropping a View Use DROP VIEW command

Introduction to Oracle9i: SQL16 Inline View Temporary table created by using subquery in FROM clause Can only be referenced while the command is being executed Most common usage – “TOP-N” Analysis

Introduction to Oracle9i: SQL17 “TOP-N” Analysis ORDER BY included to identify top values: –descending for highest values, ascending for lowest values Extract data based on ROWNUM