SlideShare a Scribd company logo
2
Most read
4
Most read
11
Most read
Oracle Database View
Eryk Budi Pratama – Dimas Aryo Anggoro
Advanced Database Lab
Informatics Engineering –Bakrie University
Definition
• A database view is a logical or virtual
table based on a query.
• It is useful to think of a view as a stored
query.
• Views are created through use of a CREATE
VIEW command that incorporates use of
the SELECT statement.
• Views are queried just like tables.
View Syntax
CREATE [OR REPLACE]
[FORCE|NOFORCE] VIEW <view
name> [(column alias name….)]
AS <query> [WITH [CHECK
OPTION] [READ ONLY]
[CONSTRAINT]];
Example
CREATE VIEW student_list
(id, last_name, first_name, email) AS
SELECT
std_id, std_last_name, std_first_name, std_email
FROM student
ORDER BY std_first_name;
Display View
SELECT * FROM <view name>;
• Only columns in the query are those
defined as part of the view
• OR REPLACE option is used to create a view that
already exists. This option is useful for
modifying an existing view without having to
drop or grant the privileges that system users
have acquired with respect to the view .
• If you attempt to create a view that already
exists without using the OR REPLACE
option, Oracle will return the ORA-00955: name
is already used by an existing object error
message and the CREATE VIEW command will
fail.
• The FORCE option allows a view to be
created even if a base table that the view
references does not already exist
• NO FORCE option allows a system user to
create a view if they have the required
permissions to create a view, and if the
tables from which the view is created
already exist. (Default Option)
• WITH READ ONLY option allows creation
of a view that is read-only
• WITH CHECK OPTION clause allows rows
that can be selected through the view to
be updated
• CONSTRAINT clause is used in conjunction
with the WITH CHECK OPTION clause to
enable a database administrator to assign
a unique name to the CHECK OPTION
View Stability
• A view does not actually store any data.
The result table is only stored temporarily.
• If a table that underlies a view is
dropped, then the view is no longer valid.
Attempting to query an invalid view will
produce an ORA-04063: view
"VIEW_NAME" has errors error message.
INSERTING, UPDATING,ANDDELETING
TABLEROWSTHROUGHVIEWS
• You can insert a row if the view in use is
one that is updateable (not read-only).
• A view is updateable if the INSERT
command does not violate any constraints
on the underlying tables.
• This rule concerning constraint violations
also applies to UPDATE and DELETE
commands.
Example
CREATE OR REPLACE VIEW std_view AS
SELECT std_no, std_name FROM student;
INSERT INTO std_view VALUES (01, ‘Student
01');
INSERT INTO std_view VALUES (02, ‘Student
02');
SELECT * FROM std_view;
Example
UPDATE std_view SET std_name = ‘Student 13‘
WHERE std_no = 13;
SELECT * FROM student WHERE std_no >= 5;
Example
DELETE std_view
WHERE std_no = 15 OR std_no = 17;
SELECT * FROM student;
Dropping View
•A DBA or view owner can drop a view
with the DROP VIEW command. The
following command drops a view
named std_view.
DROP VIEW std_view;
Summary
• A view does not store data, but a view does
display data through a SELECT query as if the
data were stored in the view.
• A view definition as provided by the CREATE
VIEW statement is stored in the database.
• A view can simplify data presentation as well as
provide a kind of data security by limiting access
to data based on a "need to know."
Summary
• A view can display data from more than one table.
• Views can be used to update the underlying tables.
Views can also be limited to read-only access.
• Views can change the appearance of data. For
example, a view can be used to rename columns
from tables without affecting the base table.
• A view that has columns from more than one table
cannot be modified by an INSERT, DELETE, or
UPDATE command if a grouping function, GROUP
BY clause is part of the view definition.
Q&A

More Related Content

What's hot (20)

PPT
MYSQL Aggregate Functions
Leroy Blair
 
PPT
Plsql
fika sweety
 
PPT
SQL subquery
Vikas Gupta
 
PPT
Creating and Managing Tables -Oracle Data base
Salman Memon
 
PPTX
Presentation slides of Sequence Query Language (SQL)
Punjab University
 
PDF
SQL Overview
Stewart Rogers
 
PPTX
SQL Commands
Sachidananda M H
 
PPTX
Oraclesql
Priya Goyal
 
PDF
PL/SQL TRIGGERS
Lakshman Basnet
 
PPTX
Oracle architecture ppt
Deepak Shetty
 
PPT
Restricting and Sorting Data - Oracle Data Base
Salman Memon
 
PPT
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
rehaniltifat
 
PPT
SQL Queries
Nilt1234
 
PPT
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
 
PDF
Triggers in plsql
Arun Sial
 
PPT
1 - Introduction to PL/SQL
rehaniltifat
 
PPT
Single-Row Functions in orcale Data base
Salman Memon
 
PPTX
SQL for interview
Aditya Kumar Tripathy
 
PDF
View & index in SQL
Swapnali Pawar
 
PPTX
SQL Functions
ammarbrohi
 
MYSQL Aggregate Functions
Leroy Blair
 
SQL subquery
Vikas Gupta
 
Creating and Managing Tables -Oracle Data base
Salman Memon
 
Presentation slides of Sequence Query Language (SQL)
Punjab University
 
SQL Overview
Stewart Rogers
 
SQL Commands
Sachidananda M H
 
Oraclesql
Priya Goyal
 
PL/SQL TRIGGERS
Lakshman Basnet
 
Oracle architecture ppt
Deepak Shetty
 
Restricting and Sorting Data - Oracle Data Base
Salman Memon
 
03 Writing Control Structures, Writing with Compatible Data Types Using Expli...
rehaniltifat
 
SQL Queries
Nilt1234
 
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
 
Triggers in plsql
Arun Sial
 
1 - Introduction to PL/SQL
rehaniltifat
 
Single-Row Functions in orcale Data base
Salman Memon
 
SQL for interview
Aditya Kumar Tripathy
 
View & index in SQL
Swapnali Pawar
 
SQL Functions
ammarbrohi
 

Viewers also liked (20)

PPTX
Dbms slides
rahulrathore725
 
PPTX
firm performance presentation(INDUSTRAT)
welcometofacebook
 
PDF
competitive pricing in business market
welcometofacebook
 
PDF
25605 tutorial migrasi database dari my sql ke oracle ( kelompok 9 )
Hendry Aryadi
 
PDF
Database reports generation(database)
welcometofacebook
 
PDF
Oracle tutorial
Lalit Shaktawat
 
PDF
Migrasi database mysql ke oracle-sql developer
Iqbal Arfandi
 
PPTX
Getting to know oracle database objects iot, mviews, clusters and more…
Aaron Shilo
 
PDF
Tutorial Migrasi Database dari Microsoft SQL Server ke Oracle Database
Hari Kurnia
 
PDF
Pluggable database tutorial 2
Osama Mustafa
 
DOC
Oracl DBA lab manual
Abdulla Shaik
 
PDF
Oracle sql tutorial
Mohd Tousif
 
PDF
Pluggable database tutorial
Osama Mustafa
 
PPTX
Oracle Tablespace - Basic
Eryk Budi Pratama
 
PDF
Pl lab solution
Ashwin Kumar
 
PPTX
EAIESB ORACLE FUSION SOA TUTORIAL Database to File Adapter Demo
Vijay Reddy
 
PPTX
Oracle Basics and Architecture
Sidney Chen
 
PPS
Oracle Database Overview
honglee71
 
PPT
Basic DBMS ppt
dangwalrajendra888
 
PDF
Oracle Forms Tutorial
ATR Login
 
Dbms slides
rahulrathore725
 
firm performance presentation(INDUSTRAT)
welcometofacebook
 
competitive pricing in business market
welcometofacebook
 
25605 tutorial migrasi database dari my sql ke oracle ( kelompok 9 )
Hendry Aryadi
 
Database reports generation(database)
welcometofacebook
 
Oracle tutorial
Lalit Shaktawat
 
Migrasi database mysql ke oracle-sql developer
Iqbal Arfandi
 
Getting to know oracle database objects iot, mviews, clusters and more…
Aaron Shilo
 
Tutorial Migrasi Database dari Microsoft SQL Server ke Oracle Database
Hari Kurnia
 
Pluggable database tutorial 2
Osama Mustafa
 
Oracl DBA lab manual
Abdulla Shaik
 
Oracle sql tutorial
Mohd Tousif
 
Pluggable database tutorial
Osama Mustafa
 
Oracle Tablespace - Basic
Eryk Budi Pratama
 
Pl lab solution
Ashwin Kumar
 
EAIESB ORACLE FUSION SOA TUTORIAL Database to File Adapter Demo
Vijay Reddy
 
Oracle Basics and Architecture
Sidney Chen
 
Oracle Database Overview
honglee71
 
Basic DBMS ppt
dangwalrajendra888
 
Oracle Forms Tutorial
ATR Login
 
Ad

Similar to Oracle Database View (20)

PDF
Sql ch 13 - sql-views
Mukesh Tekwani
 
PPT
Oracle view
Madhavendra Dutt
 
PPTX
View
Pooja Dixit
 
PPTX
Designing and Creating Views, Inline Functions, and Synonyms
Tayba Farooqui
 
PPT
Chapter 8 Views in SQL-Introduction .ppt
sivamathi12
 
PPTX
SQL lab number 10 in database system ppt
MUHAMMADANSAR76
 
PPT
Oracle training institute in hyderabad
appaji intelhunt
 
PPTX
L6 views
Rushdi Shams
 
PDF
Sql viwes
Huda Alameen
 
PPT
Views
Rahul Gupta
 
PPTX
MS Sql Server: Creating Views
DataminingTools Inc
 
PPTX
MS SQL SERVER: Creating Views
sqlserver content
 
PPTX
MS SQLSERVER:Creating Views
sqlserver content
 
PDF
Sql views
Vivek Singh
 
PPTX
V28 view
Dhirendra Chauhan
 
PPTX
View
LakshmiSamivel
 
PDF
Lesson10
renguzi
 
PPT
Module05
Sridhar P
 
Sql ch 13 - sql-views
Mukesh Tekwani
 
Oracle view
Madhavendra Dutt
 
Designing and Creating Views, Inline Functions, and Synonyms
Tayba Farooqui
 
Chapter 8 Views in SQL-Introduction .ppt
sivamathi12
 
SQL lab number 10 in database system ppt
MUHAMMADANSAR76
 
Oracle training institute in hyderabad
appaji intelhunt
 
L6 views
Rushdi Shams
 
Sql viwes
Huda Alameen
 
MS Sql Server: Creating Views
DataminingTools Inc
 
MS SQL SERVER: Creating Views
sqlserver content
 
MS SQLSERVER:Creating Views
sqlserver content
 
Sql views
Vivek Singh
 
Lesson10
renguzi
 
Module05
Sridhar P
 
Ad

More from Eryk Budi Pratama (20)

PDF
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
PDF
Digital Leadership: How to Build Valuable Connection
Eryk Budi Pratama
 
PDF
AI Solutions for Sustainable Developmentpment_public.pdf
Eryk Budi Pratama
 
PPTX
AI Governance: Responsible and Trustworthy AI
Eryk Budi Pratama
 
PDF
Ringkasan Standar Kompetensi Data Protection Officer | Agustus 2023 | IODTI
Eryk Budi Pratama
 
PDF
Implikasi UU PDP terhadap Tata Kelola Data Sektor Kesehatan - Rangkuman UU Pe...
Eryk Budi Pratama
 
PDF
Privacy-ready Data Protection Program Implementation
Eryk Budi Pratama
 
PDF
Cybersecurity 101 - Auditing Cyber Security
Eryk Budi Pratama
 
PDF
Personal Data Protection in Indonesia
Eryk Budi Pratama
 
PDF
Urgensi RUU Perlindungan Data Pribadi
Eryk Budi Pratama
 
PDF
Modern IT Service Management Transformation - ITIL Indonesia
Eryk Budi Pratama
 
PDF
Common Practice in Data Privacy Program Management
Eryk Budi Pratama
 
PDF
The Rise of Data Ethics and Security - AIDI Webinar
Eryk Budi Pratama
 
PDF
Data Protection Indonesia: Basic Regulation and Technical Aspects_Eryk
Eryk Budi Pratama
 
PDF
Data Loss Prevention (DLP) - Fundamental Concept - Eryk
Eryk Budi Pratama
 
PDF
Cyber Resilience - Welcoming New Normal - Eryk
Eryk Budi Pratama
 
PDF
Enabling Data Governance - Data Trust, Data Ethics, Data Quality
Eryk Budi Pratama
 
PDF
Enterprise Cybersecurity: From Strategy to Operating Model
Eryk Budi Pratama
 
PDF
Blockchain for Accounting & Assurance
Eryk Budi Pratama
 
PDF
Guardians of Trust: Building Trust in Data & Analytics
Eryk Budi Pratama
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
Digital Leadership: How to Build Valuable Connection
Eryk Budi Pratama
 
AI Solutions for Sustainable Developmentpment_public.pdf
Eryk Budi Pratama
 
AI Governance: Responsible and Trustworthy AI
Eryk Budi Pratama
 
Ringkasan Standar Kompetensi Data Protection Officer | Agustus 2023 | IODTI
Eryk Budi Pratama
 
Implikasi UU PDP terhadap Tata Kelola Data Sektor Kesehatan - Rangkuman UU Pe...
Eryk Budi Pratama
 
Privacy-ready Data Protection Program Implementation
Eryk Budi Pratama
 
Cybersecurity 101 - Auditing Cyber Security
Eryk Budi Pratama
 
Personal Data Protection in Indonesia
Eryk Budi Pratama
 
Urgensi RUU Perlindungan Data Pribadi
Eryk Budi Pratama
 
Modern IT Service Management Transformation - ITIL Indonesia
Eryk Budi Pratama
 
Common Practice in Data Privacy Program Management
Eryk Budi Pratama
 
The Rise of Data Ethics and Security - AIDI Webinar
Eryk Budi Pratama
 
Data Protection Indonesia: Basic Regulation and Technical Aspects_Eryk
Eryk Budi Pratama
 
Data Loss Prevention (DLP) - Fundamental Concept - Eryk
Eryk Budi Pratama
 
Cyber Resilience - Welcoming New Normal - Eryk
Eryk Budi Pratama
 
Enabling Data Governance - Data Trust, Data Ethics, Data Quality
Eryk Budi Pratama
 
Enterprise Cybersecurity: From Strategy to Operating Model
Eryk Budi Pratama
 
Blockchain for Accounting & Assurance
Eryk Budi Pratama
 
Guardians of Trust: Building Trust in Data & Analytics
Eryk Budi Pratama
 

Recently uploaded (20)

PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 

Oracle Database View

  • 1. Oracle Database View Eryk Budi Pratama – Dimas Aryo Anggoro Advanced Database Lab Informatics Engineering –Bakrie University
  • 2. Definition • A database view is a logical or virtual table based on a query. • It is useful to think of a view as a stored query. • Views are created through use of a CREATE VIEW command that incorporates use of the SELECT statement. • Views are queried just like tables.
  • 3. View Syntax CREATE [OR REPLACE] [FORCE|NOFORCE] VIEW <view name> [(column alias name….)] AS <query> [WITH [CHECK OPTION] [READ ONLY] [CONSTRAINT]];
  • 4. Example CREATE VIEW student_list (id, last_name, first_name, email) AS SELECT std_id, std_last_name, std_first_name, std_email FROM student ORDER BY std_first_name;
  • 5. Display View SELECT * FROM <view name>; • Only columns in the query are those defined as part of the view
  • 6. • OR REPLACE option is used to create a view that already exists. This option is useful for modifying an existing view without having to drop or grant the privileges that system users have acquired with respect to the view . • If you attempt to create a view that already exists without using the OR REPLACE option, Oracle will return the ORA-00955: name is already used by an existing object error message and the CREATE VIEW command will fail.
  • 7. • The FORCE option allows a view to be created even if a base table that the view references does not already exist • NO FORCE option allows a system user to create a view if they have the required permissions to create a view, and if the tables from which the view is created already exist. (Default Option)
  • 8. • WITH READ ONLY option allows creation of a view that is read-only • WITH CHECK OPTION clause allows rows that can be selected through the view to be updated • CONSTRAINT clause is used in conjunction with the WITH CHECK OPTION clause to enable a database administrator to assign a unique name to the CHECK OPTION
  • 9. View Stability • A view does not actually store any data. The result table is only stored temporarily. • If a table that underlies a view is dropped, then the view is no longer valid. Attempting to query an invalid view will produce an ORA-04063: view "VIEW_NAME" has errors error message.
  • 10. INSERTING, UPDATING,ANDDELETING TABLEROWSTHROUGHVIEWS • You can insert a row if the view in use is one that is updateable (not read-only). • A view is updateable if the INSERT command does not violate any constraints on the underlying tables. • This rule concerning constraint violations also applies to UPDATE and DELETE commands.
  • 11. Example CREATE OR REPLACE VIEW std_view AS SELECT std_no, std_name FROM student; INSERT INTO std_view VALUES (01, ‘Student 01'); INSERT INTO std_view VALUES (02, ‘Student 02'); SELECT * FROM std_view;
  • 12. Example UPDATE std_view SET std_name = ‘Student 13‘ WHERE std_no = 13; SELECT * FROM student WHERE std_no >= 5;
  • 13. Example DELETE std_view WHERE std_no = 15 OR std_no = 17; SELECT * FROM student;
  • 14. Dropping View •A DBA or view owner can drop a view with the DROP VIEW command. The following command drops a view named std_view. DROP VIEW std_view;
  • 15. Summary • A view does not store data, but a view does display data through a SELECT query as if the data were stored in the view. • A view definition as provided by the CREATE VIEW statement is stored in the database. • A view can simplify data presentation as well as provide a kind of data security by limiting access to data based on a "need to know."
  • 16. Summary • A view can display data from more than one table. • Views can be used to update the underlying tables. Views can also be limited to read-only access. • Views can change the appearance of data. For example, a view can be used to rename columns from tables without affecting the base table. • A view that has columns from more than one table cannot be modified by an INSERT, DELETE, or UPDATE command if a grouping function, GROUP BY clause is part of the view definition.
  • 17. Q&A