ready for task#124
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I’m requesting changes to ensure strict data integrity and alignment with the requirements.
Critical issues to fix:
- At
task.sql, ProductInventory currently allows duplicate rows for the same(ProductID, WarehouseID). This violates the requirement thatWarehouseAmountdepends on the product+warehouse pair and breaks 3NF. Please add a uniqueness guarantee by either: (a) making(ProductID, WarehouseID)the composite primary key, or (b) keeping the surrogateIDand addingUNIQUE (ProductID, WarehouseID). - At
task.sqlline ~53 (your INSERT intoProducts), the product name isAwersomeProduct. If the expected sample isAwesomeProduct, correct the spelling so test data matches the expected semantics exactly.
Minor suggestions (optional):
- Consider preventing negative inventory (e.g.,
INT UNSIGNEDorCHECK (WarehouseAmount >= 0)). - Optionally define explicit
ON DELETE/ON UPDATErules and set default table engine/charset.
You’ve done a solid job with schema separation, PKs/FKs, and insertion order—fixing the above will make it fully compliant. Keep going!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| CREATE TABLE ProductInventory ( | ||
| ID INT, | ||
| ProductName VARCHAR(50), | ||
| WarehouseAmount INT, | ||
| WarehouseName VARCHAR(50), | ||
| WarehouseAddress VARCHAR(50), | ||
| CountryID INT, | ||
| FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION, | ||
| PRIMARY KEY (ID) | ||
| ID INT AUTO_INCREMENT PRIMARY KEY, | ||
| ProductID INT NOT NULL, | ||
| WarehouseID INT NOT NULL, | ||
| WarehouseAmount INT NOT NULL, | ||
| FOREIGN KEY (ProductID) REFERENCES Products(ID), | ||
| FOREIGN KEY (WarehouseID) REFERENCES Warehouses(ID) |
There was a problem hiding this comment.
The ProductInventory table uses a surrogate ID but does not enforce uniqueness on the logical key (ProductID, WarehouseID). Per the requirements, the inventory amount must depend on the product+warehouse pair — add a UNIQUE(ProductID, WarehouseID) constraint or make (ProductID, WarehouseID) the composite primary key to prevent duplicate inventory rows and ensure 3NF.
|
|
||
| -- Товари | ||
| INSERT INTO Products (ProductName) | ||
| VALUES ('AwersomeProduct'); |
There was a problem hiding this comment.
Confirm the product name spelling in the INSERT: the script inserts AwersomeProduct. If the original sample expects AwesomeProduct (or another exact spelling), update this INSERT so the test data matches the original semantics exactly.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I’m requesting changes because the script does not meet a critical explicit requirement in the task description. On line 2 of task.sql, you use DROP DATABASE IF EXISTS ShopDB;, but the task requires the script to begin with the exact statement DROP DATABASE ShopDB;. This mismatch may cause automated graders to fail even if the schema is otherwise correct. Please replace line 2 with the exact line DROP DATABASE ShopDB; to satisfy the requirement.
What you did well: the schema is correctly normalized (Countries, Warehouses, Products, ProductInventory), primary/foreign keys and the unique (ProductID, WarehouseID) constraint are set, and non-negative inventory is enforced via INT UNSIGNED (note: older MySQL versions ignore CHECK).
Minor note (no change required): CHECK constraints are ignored in MySQL versions before 8.0.16; relying on INT UNSIGNED is sufficient for non-negativity. After fixing the DROP statement, your solution should fully pass the requirements. Keep up the good work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| -- Create database and tables | ||
|
|
||
| -- Видалення старої бази та створення нової | ||
| DROP DATABASE IF EXISTS ShopDB; |
There was a problem hiding this comment.
The task demands the script begin with the exact statement DROP DATABASE ShopDB;. This file uses DROP DATABASE IF EXISTS ShopDB;. Please replace line 2 with the exact required statement DROP DATABASE ShopDB; so the script matches the explicit task instruction (the grader/reviewer may look for this exact line).
| ID INT AUTO_INCREMENT PRIMARY KEY, | ||
| ProductID INT NOT NULL, | ||
| WarehouseID INT NOT NULL, | ||
| WarehouseAmount INT UNSIGNED NOT NULL CHECK (WarehouseAmount >= 0), |
There was a problem hiding this comment.
You added INT UNSIGNED NOT NULL CHECK (WarehouseAmount >= 0) which is good to prevent negative inventory. Note: older MySQL versions may ignore CHECK constraints, but INT UNSIGNED enforces non-negative values. This is an informational note — no change required unless you need to support very old MySQL versions.
No description provided.