Table of Contents
ToggleA view in SQL is a virtual table based on an SQL query. It does not store data physically, but dynamically retrieves data from the base table(s) whenever accessed.
The basic syntax for updating a view is as follows:
Let’s assume you have a table named CUSTOMERS. You can create a view with the following SQL:
After creating the view, you can update a specific record in the view. For example, to update the AGE of Ramesh to 35:
You can also update multiple rows and columns. For instance, to update both NAME and AGE of a record with ID = 3:
To update the AGE of all records by adding 6 years:
This will increase the AGE of all records in the view by 6 years.
