How to update, insert, delete the records from view

Photo by Luke Chesser on Unsplash
  • Views are logical tables which are based on one or more Tables, views, functions or synonyms.
  • View does not store the data itself.
  • The tables which are used in the view are called base table.
  • View retrieves the records at the time of execution and displays it in the result set.

Using DML Statements against the view :-

  • We can only update/Insert/Delete records of one table at a time if any type of join is used.
  • If we have used “with check options” then at the time of manipulating the data, it will check where clause of SQL statement mentioned in the view.
  • We cannot modify the data if group by or Aggregate functions are used in select statement of the view.
  • You can only manipulate columns which are given in the select statement of the view.

Examples :-

Without with check option:-

before update ;-

With “with check option”:-

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vishal Pathak

Vishal Pathak

72 Followers

love ❤ coding, solving some industry problems technologies: JavaScript, C#, Angular, PLSQL, Docker Want to learn: Python, Go language, AI, ML and Cloud