Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions task.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the task description, OrderItems is documented as having columns ID, OrderID, and ProductID. Adding Count to the column list will fail if the table schema doesn’t include this column; verify the create-database.sql and align this insert with the actual table definition used by the task.

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;
COMMIT;
Loading