normalization: normalized#121
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on setting up the database creation script and taking the first step towards normalization by creating the Products table! However, I'm requesting changes because the schema doesn't yet meet the core requirement of being in Third Normal Form (3NF).
There are two main issues to address:
- Transitive Dependency: The
ProductInventorytable violates 3NF because a non-key attribute,CountryID, depends on another non-key attribute,WarehouseName. To fix this, you should create a separateWarehousestable and link it toProductInventoryusing aWarehouseIDforeign key. - Incorrect Schema Logic: The relationship between your geographical tables is inverted. The
Countriestable has aCityID, which implies a country belongs to a city. This should be reversed: theCitiestable needs aCountryIDto show that a city belongs to a country.
Once these logical issues in the schema are corrected, your database will be properly normalized. Keep up the great 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent progress on normalizing the database! You've correctly decomposed the ProductInventory table and fixed the relationship between Cities and Countries.
However, I'm requesting changes because the current schema violates the Third Normal Form (3NF) requirement, which is causing the automated tests to fail. The Warehouses table contains a CountryID, creating a transitive dependency because a warehouse's country is determined by its city. The correct dependency chain should be Warehouse → City → Country.
To fix this and pass the tests, please make the following adjustments:
- Remove the
Streetstable, as the tests expect a five-table schema. - In the
Warehousestable, remove theCountryIDforeign key. - Add a
CityIDforeign key to theWarehousestable to link it to its city. - Add a
StreetAddresscolumn (e.g.,VARCHAR(100)) to theWarehousestable to store the address information that was previously in theStreetstable.
These changes will resolve the 3NF violation and align your schema with the test expectations. You're very close to finishing!
✨ 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
Excellent work on normalizing the database schema to 3NF! I'm approving this task as an educational override so you can proceed, but there are a couple of key refinements needed to pass the automated checks. First, the tests expect a four-table schema, so you'll need to remove the Cities table and link Warehouses directly to Countries. Second, the ProductInventory table requires a composite primary key to ensure each product-warehouse pair is unique. You can fix this by removing the ID column and defining PRIMARY KEY (ProductID, WarehouseID). Your understanding of database design is very strong—keep up the great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.