Skip to content

solution1#160

Open
Killingrace wants to merge 9 commits into
mate-academy:mainfrom
Killingrace:develop
Open

solution1#160
Killingrace wants to merge 9 commits into
mate-academy:mainfrom
Killingrace:develop

Conversation

@Killingrace
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

Great job on normalizing the database schema to the third normal form! You've correctly identified the dependencies and updated the INSERT statements, which is the core of this task. However, the script currently fails to execute because several SQL statements are missing their terminating semicolons. The automated checks confirm this with a syntax error. Please review task.sql and add a semicolon (;) at the end of each CREATE DATABASE and CREATE TABLE statement. This will ensure the entire script can be parsed and run correctly by the database server.


✨ 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
@@ -1,33 +1,37 @@
-- Create database and tables
CREATE DATABASE ShopDB
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 CREATE DATABASE statement is missing a semicolon at the end. Each SQL statement should be properly terminated for the script to be valid.

Comment thread task.sql Outdated
Comment on lines +5 to +9
Create Table Countries (
ID INT AUTO_INCREMENT,
PRIMARY KEY (ID),
NAME VARCHAR(50)
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The CREATE TABLE statement should be terminated with a semicolon.

Comment thread task.sql Outdated
Comment on lines +11 to +18
CREATE TABLE Warehouses (
ID INT AUTO_INCREMENT,
PRIMARY KEY (ID),
WarehouseName VARCHAR(50),
WarehouseAddress VARCHAR(50),
WarehouseAddress VARCHAR(50),
CountryID INT,
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION,
PRIMARY KEY (ID)
);

-- Populate test data

INSERT INTO Countries (ID,Name)
VALUES (1, 'Country1');
INSERT INTO Countries (ID,Name)
VALUES (2, 'Country2');

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);
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION
)
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 CREATE TABLE statement is also missing a terminating semicolon.

Comment thread task.sql Outdated
Comment on lines +20 to +27
CREATE TABLE ProductInventory (
ID INT AUTO_INCREMENT,
PRIMARY KEY (ID),
Name VARCHAR(50),
Amount INT,
WarehouseID INT,
FOREIGN KEY (WarehouseID) REFERENCES Warehouses(ID) ON DELETE NO ACTION
)
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 CREATE TABLE statement is missing its terminating semicolon. Ensure all SQL statements end with a ; for the script to run correctly.

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

Great job on normalizing the database and fixing the syntax from the last review! The table structure is now well-defined.

There's just one critical requirement from the task description that's missing. The script must be able to handle cases where the ShopDB database already exists, otherwise it will fail on subsequent runs.

Please add DROP DATABASE IF EXISTS ShopDB; at the very beginning of the task.sql file, before the CREATE DATABASE statement. This will make your script idempotent and fully align it with the 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
-- Create database and tables

CREATE DATABASE ShopDB;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

According to the requirements, the script should first delete the ShopDB database if it already exists. Please add DROP DATABASE IF EXISTS ShopDB; at the very beginning of this file, before the CREATE DATABASE statement.

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 approving your solution as an educational override so you can move forward, but please review the feedback carefully. You've done an excellent job normalizing the database schema to the third normal form and making the script idempotent by adding the DROP DATABASE statement!

However, the script fails because it's missing a CREATE DATABASE ShopDB; command after you drop the database. You need to re-create it before you can use it. Also, your INSERT statement for ProductInventory creates two identical records. It's better to have a single, unique record for each product in a warehouse, like VALUES (1, 1, 4); if the total quantity is 4. 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

DROP DATABASE IF EXISTS ShopDB;
CREATE DATABASE ShopDB;

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 script will fail because you're trying to use the ShopDB database before it has been created. You've dropped it on line 1, but you need to add a CREATE DATABASE ShopDB; command before this line.

Comment thread task.sql
INSERT INTO Product (Name)
VALUES ('Product-1'), ('Product-2');

INSERT INTO ProductInventory (WarehouseID, ProductID, Amount)
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 creates two identical records for ProductID 1 in WarehouseID 1. This is redundant. The purpose of this table is to store the inventory amount for a specific product in a specific warehouse, so you should have only one record for each unique product-warehouse combination.

Consider populating the inventory with more varied data using the other product and warehouse you created. For example:
VALUES (1, 1, 2), (2, 2, 5);

Copy link
Copy Markdown

@Losiev Losiev left a comment

Choose a reason for hiding this comment

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

Please check AI suggestions

@Killingrace Killingrace requested a review from Losiev April 1, 2026 11:40
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.

3 participants