From d3e8219dc624741d75a2a1b2c46ca7b7af91449d Mon Sep 17 00:00:00 2001 From: vadym Date: Tue, 14 Jul 2026 15:20:44 +0200 Subject: [PATCH] Solution --- task.sql | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/task.sql b/task.sql index 8adf22b..6b580bd 100644 --- a/task.sql +++ b/task.sql @@ -2,10 +2,16 @@ USE ShopDB; -- Some data should be created outside the transaction (here) +INSERT INTO Orders (CustomerID, Date) +VALUES (1, '2024-06-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 ID = 1; +-- And some data should be created inside the transaction --- And some data should be created inside the transaction - -COMMIT; \ No newline at end of file +COMMIT; \ No newline at end of file