Deleting a row from a view, will it delete the appropriate rows from the base tables that the view was created upon? I am using MySQL.
If you want a row to disappear from a view, you need to either delete the data from the real tables behind the view, or alter the view-creating SQL so that that particular row won't be shown in the view.
Deleting a row in a table will affect the results from regular views. Views are not executed when they are created. They are executed when they are referenced. Each time you reference the view in the query, it is run again.
To delete rows in a MySQL table, use the DELETE FROM statement: DELETE FROM products WHERE product_id=1; The WHERE clause is optional, but you'll usually want it, unless you really want to delete every row from the table.
Yes, it will. The only thing to watch out for, is permissions.
Quoting official docs
Some views are updatable. That is, you can use them in statements such as UPDATE, DELETE, or INSERT to update the contents of the underlying table. For a view to be updatable, there must be a one-to-one relationship between the rows in the view and the rows in the underlying table. There are also certain other constructs that make a view nonupdatable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With