Do Update Sql Views Update The Source Tables

SQL Programming

As a software developer, I have often encountered questions and scenarios related to SQL views and their impact on the source tables when updates are performed. Let’s dive into this interesting topic and explore the intricacies of updating SQL views and their effect on the underlying source tables.

Understanding SQL Views

Before delving into the impact of updating SQL views on the source tables, it’s essential to understand what SQL views are and how they function. In simple terms, a SQL view is a virtual table that is based on the result-set of an SQL statement. It does not store any data itself but rather retrieves data from the underlying tables dynamically when queried.

When a view is created, it essentially encapsulates a query and presents the results as a virtual table, allowing users to query and manipulate the data without directly interacting with the underlying tables. This abstraction provides a layer of security and simplifies data access for users.

Updating SQL Views

Now, let’s address the question at hand: Do updates to SQL views affect the source tables? The answer is both straightforward and nuanced. When a SQL view is updated, the underlying source tables are not directly affected. This means that modifying the data displayed through a view (such as updating, inserting, or deleting rows) does not automatically change the data in the original tables from which the view is derived.

It’s important to note that while updates to the view do not impact the source tables, the underlying tables can still be modified directly through SQL statements that target them specifically. This means that any changes made directly to the source tables will be reflected in the view, as the view’s data is derived from those tables.

Example Scenario

Let’s consider a hypothetical scenario to illustrate this concept. Suppose we have a SQL view called customer_orders_view that displays order information from a table called orders along with customer details from a table called customers. If I update the customer_orders_view to modify the customer’s shipping address, it does not change the actual data in the customers table. However, if I directly update the customers table with a new shipping address for a specific customer, this change will be reflected in the customer_orders_view as it pulls data from the customers table.


In conclusion, updating SQL views does not update the source tables themselves, but rather affects the data displayed to users querying the views. This distinction is crucial in understanding the behavior of SQL views and their relationship with the underlying tables. As a developer, it’s important to consider the implications of working with views and to ensure that data modifications are performed in the appropriate context based on the desired outcome.