From 3b787c3b55334b516e14960f6ab2a65a987f6ea4 Mon Sep 17 00:00:00 2001 From: oleksii_lyashenko Date: Sat, 30 May 2026 20:03:22 +0300 Subject: [PATCH] result --- task.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/task.sql b/task.sql index 8adf22b..88a4560 100644 --- a/task.sql +++ b/task.sql @@ -1,11 +1,17 @@ -- Use our database 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; --- And some data should be created inside the transaction +INSERT INTO OrderItems (OrderID, ProductID, Count) +VALUES (LAST_INSERT_ID(), 1, 1); + +UPDATE Products +SET WarehouseAmount = WarehouseAmount - 1 +WHERE ID = 1; COMMIT; \ No newline at end of file