Skip to content

Solved#127

Open
NizArtem wants to merge 4 commits into
mate-academy:mainfrom
NizArtem:Develop
Open

Solved#127
NizArtem wants to merge 4 commits into
mate-academy:mainfrom
NizArtem:Develop

Conversation

@NizArtem

@NizArtem NizArtem commented Nov 4, 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

You've made a great start on normalizing the database by creating the Warehouse table! However, a couple of critical issues are preventing the task from being completed.

First, the database is not yet in third normal form (3NF). The CountryID column is still in the ProductInventory table, which creates a transitive dependency (ProductInventory.IDWarehouseIDCountryID). To fix this, please move the CountryID column into the Warehouse table.

Second, an INSERT statement for ProductInventory is incorrect and causes the script to fail. It attempts to insert data into WarehouseName and WarehouseAddress, but those columns were correctly removed from that table. You'll need to update this statement to use the new table structure.

Please address these two points.


✨ 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 on lines +12 to +17
CREATE TABLE Warehouse (
ID INT,
Name VARCHAR(50),
Address VARCHAR(50),
PRIMARY KEY (ID)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job creating a separate Warehouse table to resolve the dependency on warehouse details. To fully achieve 3NF, you should also move the CountryID into this table. A warehouse is always in one country, so CountryID functionally depends on WarehouseID.

Comment thread task.sql
Comment on lines 19 to 28
CREATE TABLE ProductInventory (
ID INT,
ProductName VARCHAR(50),
WarehouseAmount INT,
WarehouseName VARCHAR(50),
WarehouseAddress VARCHAR(50),
WarehouseID INT,
CountryID INT,
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION,
FOREIGN KEY (WarehouseID) REFERENCES Warehouse(ID) ON DELETE NO ACTION,
PRIMARY KEY (ID)
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Because CountryID is determined by the WarehouseID, keeping CountryID in this table creates a transitive dependency (ProductInventory.ID -> WarehouseID -> CountryID). To adhere to 3NF, the CountryID column and its foreign key constraint should be removed from this table and placed in the Warehouse table instead.

Comment thread task.sql Outdated
Comment on lines +30 to +45
INSERT INTO ProductInventory (ID,ProductName,WarehouseAmount,WarehouseName,WarehouseAddress,CountryID)
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);
VALUES (2, 'AwersomeProduct', 5, 2, 2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This INSERT statement is incorrect and will cause an error. The ProductInventory table, as you've defined it, does not contain WarehouseName or WarehouseAddress columns. You need to update this statement to match the columns in your new table schema.

@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 normalizing the schema by creating the Warehouse table! This requires a few changes before it's ready. The script currently fails because one of the INSERT statements for ProductInventory is incorrect; it still references the old WarehouseName and WarehouseAddress columns that you correctly removed. Please update this statement to match the new table structure. Also, the script is missing the required DROP DATABASE IF EXISTS ShopDB; command at the beginning, which is needed to ensure it can be run multiple times. After fixing these two items, your solution will be perfect!


✨ 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 on lines +44 to +45
INSERT INTO ProductInventory (ID,ProductName,WarehouseAmount,WarehouseName,WarehouseAddress)
VALUES (2, 'AwersomeProduct', 5, 2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This INSERT statement is incorrect and will cause the script to fail. The ProductInventory table no longer has the WarehouseName and WarehouseAddress columns. You'll need to update the column list to match the new table structure, similar to the INSERT statement on the line above.

@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 and correcting the INSERT statements! The table structure is now well-designed and follows best practices.

I am approving this submission as an educational override so you can continue to the next task, but please note one important point for the future. Your script is not re-runnable because it will fail if the ShopDB database already exists. To make scripts like this robust, always include DROP DATABASE IF EXISTS ShopDB; at the very beginning.

Great progress, and keep up the fantastic work!


✨ 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