SlideShare ist ein Scribd-Unternehmen logo
1 von 18
DML Operations and
Views
What Will I Learn?
• Performs DML operations on a simple view
• Name the conditions that restrict your ability to
modify a view using DML operations
• Write and execute a query using the WITH
CHECK OPTION clause
– Explain the use of WITH CHECK OPTION as it
applies to integrity constraints and data validation

• Apply the WITH READ ONLY option to a view to
restrict DML operations
• Use Internet resources to identify future trends,
innovations, and directions in the future of
computing
home back first prev next last
2
Why Learn It?
• As you learned in the last lesson, views simplify
queries that require data collected from multiple
tables in the database.
• However, views also allow users to make
changes to the underlying tables.
– As the DBA and the person whose job it is to
maintain the integrity of the database, you will
want to put constraints on these views of the data.

• In this lesson, you will learn how to allow data
access and at the same time ensure data
security.
home back first prev next last
3
Why Learn It?
• Have you ever wondered what your classroom
will look like in 20 years?
– A new generation of students will be sitting in
your chairs.
– Will they be staring at huge monitors or sitting
comfortably using their own hand-held personal
computer?
– Maybe school will be something we do from
home. Interesting thought, isn't it?

• In this lesson, you will have an opportunity to
look at what's next in computing.
– You'll be part of shaping the future.
home back first prev next last
4
DML STATEMENTS AND VIEWS
• The DML operations INSERT, UPDATE, and
DELETE can be performed on simple views.
• These operations can be used to change the
data in the underlying base tables.
• If you create a view that allows users to view
restricted information using the WHERE clause,
users can still perform DML operations on all of
the view's columns.

home back first prev next last
5
DML STATEMENTS AND VIEWS
• For example, the view
shown at right was
created for the
managers of
department 50 from the
Oracle database.
• The intent of this view is
to allow managers of
department 50 to see
information about their
employees.

CREATE VIEW view_dept50 AS
SELECT department_id, employee_id,
first_name, last_name, salary
FROM employees
WHERE department_id = 50;

home back first prev next last
6
DML STATEMENTS AND VIEWS
• Using the view as stated,
– it is possible to INSERT, UPDATE, and DELETE
information for all departments.
UPDATE view_dept50 SET department_id=60 WHERE
employee_id=124;

– This may not be what the DBA intended when the
view was created.
– To control data access, two options can be added
to the CREATE VIEW statement:
 WITH CHECK OPTION
 WITH READ ONLY

home back first prev next last
7
WITH CHECK OPTION
• The WITH CHECK OPTION ensures that DML
operations performed on the view stay within the domain
of the view.
• Any attempt to change the department_id for any row in
the view fails because it violates the WITH CHECK
OPTION constraint.
• Notice in the example below that the WITH CHECK
OPTION CONSTRAINT was given the name
view_dept50_check.
CREATE OR REPLACE VIEW view_dept50 AS
SELECT department_id, employee_id, first_name, last_name,
salary
FROM employees
WHERE department_id = 50
home back first prev next
WITH CHECK OPTION CONSTRAINT view_dept50_check;last8
WITH READ ONLY
• The WITH READ ONLY option ensures that no
DML operations occur through the view.
– Any attempt to execute an INSERT, UPDATE, or
DELETE statement will result in an Oracle server
error.
CREATE OR REPLACE VIEW view_dept50 AS
SELECT department_id, employee_id, first_name,
last_name, salary
FROM employees
WHERE department_id = 50;
WITH READ ONLY;
home back first prev next last
9
DML RESTRICTIONS
• Simple views and complex views
differ in their ability to allow DML
operations through a view.
– For simple views, DML operations
can be performed through the view.
– For complex views, DML operations
are not always allowed.
– The following 3 rules must be
considered when performing DML
operations on views.
home back first prev next last
10
Complex views DML rules
(1) You cannot remove a
row from an underlying
base table if the view
contains any of the
following:

SELECT rownum, first_name
FROM employees
WHERE emloyee_id
BETWEEN 100 AND 105;

– Group functions
– A GROUP BY clause
– The DISTINCT keyword
– The pseudocolumn
ROWNUM Keyword
home back first prev next last
11
Complex views DML rules
(2) You cannot modify data through a
view if the view contains:
– Group functions
– A GROUP BY clause
– The DISTINCT keyword
– The pseudocolumn ROWNUM keyword
– Columns defined by expressions

home back first prev next last
12
Complex views DML rules
(3) You cannot add data through a view if
the view
– includes group functions
– includes a GROUP BY clause
– includes the DISTINCT keyword
– includes the pseudocolumn ROWNUM
keyword
– includes columns defined by expressions
– does not include NOT NULL columns in the
base tables
home back first prev next last
13
Complex views DML rules

•多行对一行( Group functions 、 GROUP BY 、 DISTINCT ),不可
以增、删、改。
•和记录返回顺序有关( ROWNUM ),不可以增、删、改。
•多列对一列( expression Columns ),可以删,不可以增、改。
•基表非空列不在视图中,不可以增,可以删、改。
•删除限制最少,增加限制最多

home back first prev next last
14
WHAT'S NEXT IN COMPUTING?
• Moore's Law
– which states that the number of transistors on a
given chip can be doubled every two years
– has been the guiding principle of progress in
electronics and computing
– since Moore first formulated the famous
prediction in 1965.

• What will technology "look like" in 20 years, in a
hundred years?
– Many people are wondering the same thing and
working to turn their dreams into reality.
– Let’s look into the future of computing and
technology.
– It's your future and you will be a part of it. first prev next last15
home back
Future Trends To Consider
•
•
•
•
•
•
•

Wireless technologies -- when can we pull the plug?
How big is big? What technologies are being developed to store
large quantities of information?
How much is too much? What are the trends in storing personal data
and what are the issues being addressed related to personal
privacy?!
What is data mining? How can businesses target product advertising
gleaned from data stored about your buying habits or Internet
browsing preferences?
How can we make computers know how we see and feel?
What technologies are being developed to protect copyrighted
material?
How small is small? What are the limits to miniaturizing computer
technologies? Can a phone, computer, and camera be integrated
into a wrist watch?
home back first prev next last
16
Terminology
• Key term used in this lesson include:
– ROWNUM
– WITH CHECK OPTION
– WITH READ ONLY

home back first prev next last
17
Summary
• In this lesson you have learned to:
– Performs DML operations on a simple view
– the conditions that restrict your ability to
modify a view using DML operations
– WITH CHECK OPTION clause
– WITH READ ONLY option
– Use Internet resources to identify future
trends, innovations, and directions in the
future of computing
home back first prev next last
18

Weitere ähnliche Inhalte

Kürzlich hochgeladen

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Kürzlich hochgeladen (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

DML_Operations_and_views

  • 2. What Will I Learn? • Performs DML operations on a simple view • Name the conditions that restrict your ability to modify a view using DML operations • Write and execute a query using the WITH CHECK OPTION clause – Explain the use of WITH CHECK OPTION as it applies to integrity constraints and data validation • Apply the WITH READ ONLY option to a view to restrict DML operations • Use Internet resources to identify future trends, innovations, and directions in the future of computing home back first prev next last 2
  • 3. Why Learn It? • As you learned in the last lesson, views simplify queries that require data collected from multiple tables in the database. • However, views also allow users to make changes to the underlying tables. – As the DBA and the person whose job it is to maintain the integrity of the database, you will want to put constraints on these views of the data. • In this lesson, you will learn how to allow data access and at the same time ensure data security. home back first prev next last 3
  • 4. Why Learn It? • Have you ever wondered what your classroom will look like in 20 years? – A new generation of students will be sitting in your chairs. – Will they be staring at huge monitors or sitting comfortably using their own hand-held personal computer? – Maybe school will be something we do from home. Interesting thought, isn't it? • In this lesson, you will have an opportunity to look at what's next in computing. – You'll be part of shaping the future. home back first prev next last 4
  • 5. DML STATEMENTS AND VIEWS • The DML operations INSERT, UPDATE, and DELETE can be performed on simple views. • These operations can be used to change the data in the underlying base tables. • If you create a view that allows users to view restricted information using the WHERE clause, users can still perform DML operations on all of the view's columns. home back first prev next last 5
  • 6. DML STATEMENTS AND VIEWS • For example, the view shown at right was created for the managers of department 50 from the Oracle database. • The intent of this view is to allow managers of department 50 to see information about their employees. CREATE VIEW view_dept50 AS SELECT department_id, employee_id, first_name, last_name, salary FROM employees WHERE department_id = 50; home back first prev next last 6
  • 7. DML STATEMENTS AND VIEWS • Using the view as stated, – it is possible to INSERT, UPDATE, and DELETE information for all departments. UPDATE view_dept50 SET department_id=60 WHERE employee_id=124; – This may not be what the DBA intended when the view was created. – To control data access, two options can be added to the CREATE VIEW statement:  WITH CHECK OPTION  WITH READ ONLY home back first prev next last 7
  • 8. WITH CHECK OPTION • The WITH CHECK OPTION ensures that DML operations performed on the view stay within the domain of the view. • Any attempt to change the department_id for any row in the view fails because it violates the WITH CHECK OPTION constraint. • Notice in the example below that the WITH CHECK OPTION CONSTRAINT was given the name view_dept50_check. CREATE OR REPLACE VIEW view_dept50 AS SELECT department_id, employee_id, first_name, last_name, salary FROM employees WHERE department_id = 50 home back first prev next WITH CHECK OPTION CONSTRAINT view_dept50_check;last8
  • 9. WITH READ ONLY • The WITH READ ONLY option ensures that no DML operations occur through the view. – Any attempt to execute an INSERT, UPDATE, or DELETE statement will result in an Oracle server error. CREATE OR REPLACE VIEW view_dept50 AS SELECT department_id, employee_id, first_name, last_name, salary FROM employees WHERE department_id = 50; WITH READ ONLY; home back first prev next last 9
  • 10. DML RESTRICTIONS • Simple views and complex views differ in their ability to allow DML operations through a view. – For simple views, DML operations can be performed through the view. – For complex views, DML operations are not always allowed. – The following 3 rules must be considered when performing DML operations on views. home back first prev next last 10
  • 11. Complex views DML rules (1) You cannot remove a row from an underlying base table if the view contains any of the following: SELECT rownum, first_name FROM employees WHERE emloyee_id BETWEEN 100 AND 105; – Group functions – A GROUP BY clause – The DISTINCT keyword – The pseudocolumn ROWNUM Keyword home back first prev next last 11
  • 12. Complex views DML rules (2) You cannot modify data through a view if the view contains: – Group functions – A GROUP BY clause – The DISTINCT keyword – The pseudocolumn ROWNUM keyword – Columns defined by expressions home back first prev next last 12
  • 13. Complex views DML rules (3) You cannot add data through a view if the view – includes group functions – includes a GROUP BY clause – includes the DISTINCT keyword – includes the pseudocolumn ROWNUM keyword – includes columns defined by expressions – does not include NOT NULL columns in the base tables home back first prev next last 13
  • 14. Complex views DML rules •多行对一行( Group functions 、 GROUP BY 、 DISTINCT ),不可 以增、删、改。 •和记录返回顺序有关( ROWNUM ),不可以增、删、改。 •多列对一列( expression Columns ),可以删,不可以增、改。 •基表非空列不在视图中,不可以增,可以删、改。 •删除限制最少,增加限制最多 home back first prev next last 14
  • 15. WHAT'S NEXT IN COMPUTING? • Moore's Law – which states that the number of transistors on a given chip can be doubled every two years – has been the guiding principle of progress in electronics and computing – since Moore first formulated the famous prediction in 1965. • What will technology "look like" in 20 years, in a hundred years? – Many people are wondering the same thing and working to turn their dreams into reality. – Let’s look into the future of computing and technology. – It's your future and you will be a part of it. first prev next last15 home back
  • 16. Future Trends To Consider • • • • • • • Wireless technologies -- when can we pull the plug? How big is big? What technologies are being developed to store large quantities of information? How much is too much? What are the trends in storing personal data and what are the issues being addressed related to personal privacy?! What is data mining? How can businesses target product advertising gleaned from data stored about your buying habits or Internet browsing preferences? How can we make computers know how we see and feel? What technologies are being developed to protect copyrighted material? How small is small? What are the limits to miniaturizing computer technologies? Can a phone, computer, and camera be integrated into a wrist watch? home back first prev next last 16
  • 17. Terminology • Key term used in this lesson include: – ROWNUM – WITH CHECK OPTION – WITH READ ONLY home back first prev next last 17
  • 18. Summary • In this lesson you have learned to: – Performs DML operations on a simple view – the conditions that restrict your ability to modify a view using DML operations – WITH CHECK OPTION clause – WITH READ ONLY option – Use Internet resources to identify future trends, innovations, and directions in the future of computing home back first prev next last 18