Transactions
As part of database management, soon enough, we will probably make direct data changes through database management tools. In other words, we may use a MySQL query window to make a direct insert, update, and delete changes to live production data. We know how to make those changes with relevant SQL statements, but so far, we have not looked at a way to reverse these changes. Even one mistake could potentially destroy data resources worth billions. Fortunately, SQL products offer the TRANSACTION
function as a way to execute SQL statements in a reversible way.
From the PACKT_ONLINE_SHOP
database, from the Products
table, let's query the product with the product ID 3
:
USE PACKT_ONLINE_SHOP; SELECT ProductID, Availablequantity FROM Products WHERE productid = 3;
This query will yield the following output:
From the output, we can see that the product with product ID 3
has 1...