Skip to content

database normalized#161

Open
yaroslav-demchenko wants to merge 2 commits into
mate-academy:mainfrom
yaroslav-demchenko:main
Open

database normalized#161
yaroslav-demchenko wants to merge 2 commits into
mate-academy:mainfrom
yaroslav-demchenko:main

Conversation

@yaroslav-demchenko
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

I am requesting changes because the current task.sql does not yet meet several core requirements and the automated tests are failing. First, at the top of task.sql you create ShopDB but never drop an existing one; you need to add a DROP DATABASE IF EXISTS ShopDB; before CREATE DATABASE ShopDB; so the script can be safely re-run as required by the checklist [CHECKLIST ITEM #10/#13/#14]. Second, the schema is not fully normalized to 3NF, because ProductInventory still stores ProductName directly; you should introduce a Products table (for example ProductID as primary key and Name) and change ProductInventory to hold a ProductID foreign key referencing Products(ProductID), alongside its existing foreign key to Warehouses [CHECKLIST ITEM #2/#3]. Third, after this schema change, the INSERT statements at the bottom must be updated so that you insert rows into Products first and then insert into ProductInventory using the proper ProductID and WarehouseID, while preserving the original test data values [CHECKLIST ITEM #4/#5]. These issues are what cause the test errors about the wrong number of tables and foreign keys on ProductInventory, so they must be fixed before the task can be considered complete. As minor improvements (not blockers), you might also consider adding AUTO_INCREMENT and NOT NULL to your ID columns to better reflect typical MySQL practices. Once you’ve made these changes, re-run task.sql followed by test.sql locally to confirm everything executes without errors, and your overall structure—which is already on the right track with separate Countries and Warehouses tables—should then satisfy the normalization and checklist requirements.


✨ 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
Comment thread task.sql
Comment thread task.sql Outdated
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Your solution is approved because task.sql correctly recreates ShopDB, normalizes the schema into separate Products, Warehouses, Countries, and ProductInventory tables, and updates the INSERT statements to match the new foreign-key-based design while preserving the original data values. The structure of ProductInventory now properly supports per-warehouse product quantities by referencing both ProductID and WarehouseID, which aligns with the core functional requirements. There are no evident blockers or broken functionality in the SQL definition itself, assuming task.sql and then test.sql are run in order on a MySQL server as intended.

As minor, non-blocking improvements, you might consider updating the Countries table definition near the top of task.sql so that ID is AUTO_INCREMENT NOT NULL, for consistency with other primary keys and easier future inserts. Similarly, adding NOT NULL constraints to key name columns like Countries.Name, Warehouses.Name, and Products.Name would strengthen data integrity and better reflect that these fields are required in practice. Overall, you’ve implemented the requested normalization and checklist changes well—nice work on aligning the schema design with 3NF and keeping the test data compatible with the new structure.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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