Skip to content

normalization: normalized#121

Open
kenu21 wants to merge 5 commits into
mate-academy:mainfrom
kenu21:normalization
Open

normalization: normalized#121
kenu21 wants to merge 5 commits into
mate-academy:mainfrom
kenu21:normalization

Conversation

@kenu21

@kenu21 kenu21 commented Sep 20, 2025

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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:

  1. Transitive Dependency: The ProductInventory table violates 3NF because a non-key attribute, CountryID, depends on another non-key attribute, WarehouseName. To fix this, you should create a separate Warehouses table and link it to ProductInventory using a WarehouseID foreign key.
  2. Incorrect Schema Logic: The relationship between your geographical tables is inverted. The Countries table has a CityID, which implies a country belongs to a city. This should be reversed: the Cities table needs a CountryID to 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql Outdated
Comment thread task.sql

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 WarehouseCityCountry.

To fix this and pass the tests, please make the following adjustments:

  1. Remove the Streets table, as the tests expect a five-table schema.
  2. In the Warehouses table, remove the CountryID foreign key.
  3. Add a CityID foreign key to the Warehouses table to link it to its city.
  4. Add a StreetAddress column (e.g., VARCHAR(100)) to the Warehouses table to store the address information that was previously in the Streets table.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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! ✨

Footnotes

  1. Rate AI review example

Comment thread task.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants