diff --git a/task.sql b/task.sql index 8adf22b..5d59b67 100644 --- a/task.sql +++ b/task.sql @@ -3,9 +3,13 @@ USE ShopDB; -- Some data should be created outside the transaction (here) +INSERT INTO Orders (CustomerID, Date) + VALUES (1, "2023-01-01"); -- Start the transaction START TRANSACTION; - +INSERT INTO OrderItems (OrderID, ProductID, Count) + VALUES (LAST_INSERT_ID(), 1, 1); +UPDATE Products SET WarehouseAmount = WarehouseAmount - 1 where Name = "AwersomeProduct"; -- And some data should be created inside the transaction COMMIT; \ No newline at end of file