Why is the view updated in Oracle?

I just found that the view is being updated in oracle. When updating a view as a result, the updated table is updated.

UPDATE (SELECT * FROM T where T.col1='val1') as D SET D.col2 ='some_val' example UPDATE (SELECT * FROM T where T.col1='val1') as D SET D.col2 ='some_val'

After executing the sql example, table T will be updated.

I do not understand why Oracle supports this feature.

As this question is described in mysql, the view is not updated.

+5
source share
1 answer

It might be instructive to look at the Coding Rules for relational databases.

Rule 7:

Rule 7: Insert, update, and delete a high level:

The ability to process a base relationship or derived relationship as one operand applies not only to data extraction, but also to insert, update and delete data.

My emphasis is - and note that an important aspect that many people make mistakes in relational databases is that the words "relation" or "relational" average relations are what are called tables in SQL. Many people believe that the "relational" in relational databases is the same as the relation in the entity relationship model, and therefore jumps into the assumption that the relational relationship somehow refers to, for example, Foreign keys.

Now I’m not saying that SQL, either as embodied in the ANSI standard, or as embodied in any particular product, is a complete implementation of Codd Rules (indeed, rule 6 is quite problematic), but there is, at least, trying to implement them in some products.

+5
source

All Articles