Edit task.sql#189
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because there are still a couple of checklist-related issues that can block running your script as-is, even though your normalization work is solid. Your 3NF design is correct: splitting the original ProductInventory into Products and Warehouses and using foreign keys in ProductInventory fully supports multiple warehouses and removes redundant data. However, you do not include a DROP DATABASE ShopDB; (or DROP DATABASE IF EXISTS ShopDB;) before CREATE DATABASE ShopDB;, which can cause the script to fail on reruns if the database already exists [CHECKLIST ITEM #9]; add this at the very top so the script is reliably repeatable. Also, ensure that Products and Warehouses are created before ProductInventory (or add foreign keys via ALTER TABLE afterward), so MySQL never tries to create FKs to tables that do not yet exist, which can break execution on some configurations. Once you fix the database drop order and the table/foreign key creation order, your solution will meet the functional and checklist requirements, and the rest of the changes (like minor typos or legacy commented inserts) are optional polish. You’re very close—your schema design is strong; you just need these small structural fixes to make the script robust and compliant.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because the current ProductInventory table structure still conflicts with the automated tests and the stated normalization requirements. Specifically, the tests report that ProductInventory has an incorrect number of columns and foreign keys, and that a CountryID foreign key is present in this table, which should not be there. ProductInventory is expected to link products to warehouses only (e.g., via ProductID, WarehouseID, and Quantity), so you should remove any CountryID column/foreign key and ensure you only reference Products and Warehouses. This mismatch causes the schema validation tests to fail, which is a critical blocker for task completion.
To fix this, carefully adjust your CREATE TABLE ProductInventory statement so it has exactly the expected columns (no extra attributes like CountryID) and only the required foreign keys to the product and warehouse tables. After changing the table definition, update your INSERT statements to match the new column list (e.g., inserting only product, warehouse, and quantity-related data). On the positive side, your database setup (DROP DATABASE IF EXISTS + CREATE DATABASE) and the overall normalization into Countries, Products, Warehouses, and ProductInventory are well structured and close to the intended design. Once you correct the ProductInventory schema and its inserts, your solution should align fully with the requirements and pass the tests.
✨ 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
| VALUES (1, 'AwersomeProduct', 2, 'Warehouse-1', 'City-1, Street-1',1); | ||
| INSERT INTO ProductInventory (ID,ProductName,WarehouseAmount,WarehouseName,WarehouseAddress,CountryID) | ||
| VALUES (2, 'AwersomeProduct', 5, 'Warehouse-2', 'City-2, Street-2',2); | ||
| INSERT INTO Products (ID, Name) VALUES (1, 'AwersomeProduct'); |
There was a problem hiding this comment.
The product name is spelled AwersomeProduct here; this matches your previous test data, so functionally it’s fine, but if this wasn’t intentional you might want to correct it to AwesomeProduct in both schema and tests for clarity.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because your schema is correctly normalized into Countries, Products, Warehouses, and ProductInventory, and the foreign keys and inserts now match the intended 3NF design [CHECKLIST ITEM #2, #3, #17–#21]. Your separation of warehouse-specific data into Warehouses and the use of ProductInventory purely as a link table with quantity is exactly what was needed, and your test data clearly mirrors the original scenario in the new structure [CHECKLIST ITEM #4, #11, #12]. One small improvement opportunity is that you used DROP DATABASE IF EXISTS ShopDB; instead of the exact DROP DATABASE ShopDB; requested, which is functionally correct but slightly different from the literal requirement [CHECKLIST ITEM #9, #13]; this is an educational override to help you progress while learning.
If you want to align perfectly with strict instructions in future assignments, you could match the exact DROP statement text unless there is a clear reason not to. Overall, your work shows a solid understanding of normalization and referential integrity, and you’ve addressed the previous review points thoroughly. Nicely done—this is a strong, production-like SQL script that should serve you well as a learning reference.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.